AngularJs-CSS文件之间的路由 [英] AngularJs - routing between css files

查看:56
本文介绍了AngularJs-CSS文件之间的路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..指ngRoute,

​Hi all.. referring to ngRoute,

我创建了一个页面应用程序,但希望将不同的CSS规则应用于每个子页面(如背景图片)

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

我该怎么做?

我为每个子页面分配了一个不同的控制器在链接标记中,我使用ng-href和{{name}}.css告诉浏览器抓取正确的css文件,其中name是给出文件名的值,并附加到相应控制器内部的作用域中.是否需要使用多个ng-controller?这是视图: http://shireefkhatab.github.io/imax-design 和我的代码: https://github.com/shireefkhatab/imax-design

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​

希望得到回应谢谢大家.Reefo.

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

推荐答案

您可以在模板(视图)中包含这些样式,也可以为样式创建单独的路线,将其视图添加到头部,然后使用 $ state.go('where.ever.you.want.to.go');

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');

这篇关于AngularJs-CSS文件之间的路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆