简体   繁体   English

IE8中的Angular View无法呈现CSS样式

[英]CSS Styles not rendering for Angular View in IE8

I have an angular app that is working well except in IE8. 除了IE8,我有一个运行良好的角度应用程序。 Essentially, my styles from the external stylesheet are not taking effect on code that is rendered inside of my view. 本质上,外部样式表中的样式对在视图内部呈现的代码不起作用。 I've followed the Angular IE guide. 我遵循了Angular IE指南。 Here is the code I have on my html element: 这是我在html元素上的代码:

<!--[if IE 8]>         
<html class="no-js lt-ie9" xmlns:ng='http://angularjs.org' id='ng-app' ng-app='HPApp' ng-controller='HPMainController' ng-init='loadHP()'> 
<![endif]-->

I later render an IE specific stylesheet, otherwise I use data binding to render a stylsheet specific to the URL 稍后我呈现IE特定的样式表,否则我使用数据绑定来呈现特定于URL的样式表

<!--[if IE 8]>
<link rel="stylesheet" href="css/ie.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" ng-href="css/{{cssPath}}">
<!--<![endif]-->

Later in the body of my html I have a div with a ng-view attribute 稍后在我的html正文中,我有一个具有ng-view属性的div

<div ng-view></div>

If I delete the div with ng-view and hardcode in my template my styles take effect. 如果我在模板中使用ng-view和hardcode删除div,则样式会生效。 Otherwise, my styles seem to be applied to the page before the template is rendered. 否则,我的样式似乎会在呈现模板之前应用于页面。

Also, note that if I use the ng-href attribute on my IE specific stylesheet, IE will not load it at all. 另外,请注意,如果我在IE特定样式表上使用ng-href属性,则IE根本不会加载它。

Did you add 你加了吗

document.createElement('ng-view');

to your index file ? 到您的索引文件?

angular doc p.4 角度文件p.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM