AngularJs - routing between css files

2019-09-09 21:04发布

问题:

​Hi all.. referring to ngRoute,

i created a single page application but would like to apply different css rules to each sub-page like background image

how can i do that?

i assigned a different controller to each sub-page and in the link tag i used ng-href and {{name}}.css to tell the browser to grap the correct css file where is name is giving the value of the file name and attached to the scope inside the corresponding controller. is there a need to use more than one ng-controller ? here is the view : http://shireefkhatab.github.io/imax-design and my code : https://github.com/shireefkhatab/imax-design​

hope to get a response thank you all in advance. Reefo.

回答1:

You can include those styles in your template (views) or make separate route for styles, add its view in head section and then change state from your controller using $state.go('where.ever.you.want.to.go');