【发布时间】:2014-05-24 22:57:00
【问题描述】:
在我的具有 ui-router 依赖项的 AngularJS 应用程序中,出于某种原因 - 在 Google Chrome 上 - 我的样式表中的 background-images 没有加载(甚至没有显示在开发工具的网络选项卡中)。
也许是因为我已经将链接 href 绑定到我的范围,并即时更改它?
index.html:
<link rel='stylesheet' ngIf='stylePath' ng-href='{{stylePath}}'>
在我的控制器中,我将$scope.stylePath 设置为'login.css'。
如果我打开开发工具并取消选中background-image,然后再次选中它,它会加载图像并正常显示。
在 IE11 上没有问题。
有什么想法吗?
【问题讨论】:
-
不考虑太多,我会尝试删除
ngIf并查看是否是导致问题的原因(然后从那里开始工作)。 -
指令不能包含大写字母,因为 Angular 会将它们转换为小写破折号。 ngIf 例如应该用作 ng-if
标签: angularjs google-chrome resources stylesheet angular-ui-router