Thank you for your replies, and It was quite simple actually, let me
explain.

First, you add a <link> tag with id e.g

<link id="layout-styles" rel="stylesheet" href="">

Next, you'll need to create separate feature modules, "frontend", and
"dashboard" (https://angular.io/docs/ts/latest/guide/ngmodule.html)
Next in the constructor of each module main component like for frontend it
would be frontend.component.ts you simply use

document.getElementById('layout-styles').setAttribute('href', this.cssFile);

this.cssFile is private class member inside the FrontendComponent.


On Tue, Aug 30, 2016 at 4:12 AM, Priest <[email protected]> wrote:

> If i understood you correctly, you want same component has different
> styles in different route view,
> if so, i create a example in plunker http://plnkr.co/edit/
> gV3i2YPendxSaX46lAbk?p=preview, forget :host section i posted before,
> sorry...
>
>
> On Sunday, August 28, 2016 at 2:53:22 AM UTC+8, Ubaid ur Rahman wrote:
>>
>> Hello,
>>
>> I am playing around with angular, and I came up across this issue, I am
>> trying to have 2 different views (1) Frontend (2) Dashboard.
>> I want to enable different CSS files for each end dynamically i.e. if a
>> user goes to http://xyz.com/frontend, inside header the stylesheet link
>> must be:
>> <link href="/app/css/frontend.css" rel="stylesheet" type="text/css">
>> if user goes to http://xyz.com/dashboard the stylesheet link should
>> become
>> <link href="/app/css/dashboard.css" rel="stylesheet" type="text/css">
>>
>> How can I accomplish this?
>>
>> I tried "styleUrls" it injects the styles inside header and I don't want
>> that.
>>
>> Can some one help.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/angular/P6k04WoFN2I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards,

Ubaid ur Rahman

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to