为了让 AngularJS 在 IE7 和 IE8 中工作,我将 id="ng-app"和 class="ng-app"添加到我的 ng-app 元素:
<html id="ng-app" class="ng-app" ng-app="myApp">
<div ng-view></div>
</html>
这在过去一直有效,但现在我已将 class="ng-app"添加到两个不同的项目中,并且在这两个 View 中都不再在任何浏览器中呈现。实现 IE7/8 兼容性的方式有变化吗?我使用的是 CDN 的 1.0.2 版。
谢谢你。
最佳答案
编辑说明:添加 doctype 标签会减少一些问题。
谢谢@Mike Pateras
<!doctype html>
原来的:
尝试这个
<html lang="en" class="ng-app:myapp" id="ng-app" ng-app="myapp" xmlns:ng="http://angularjs.org">
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lte IE 8]>
<script>
document.createElement('ng-include');
document.createElement('ng-pluralize');
document.createElement('ng-view');
document.createElement('ng:include');
document.createElement('ng:pluralize');
document.createElement('ng:view');
</script>
<![endif]-->
<!--[if lt IE 8]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json2/20150503/json2.min.js"></script>
<![endif]-->
</head>
关于internet-explorer-8 - 为什么 ng-class ="ng-app"会破坏 AngularJS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13184063/