为什么 ng-class="ng-app"打破 AngularJS? [英] Why does ng-class="ng-app" break AngularJS?
本文介绍了为什么 ng-class="ng-app"打破 AngularJS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了让 AngularJS 在 IE7 和 IE8 中工作,我将 id="ng-app" 和 class="ng-app" 添加到我的 ng-app 元素:
To get AngularJS to work in IE7 and IE8, I add id="ng-app" and class="ng-app" to my ng-app element:
<html id="ng-app" class="ng-app" ng-app="myApp">
<div ng-view></div>
</html>
这在过去一直有效,但现在我已将 class="ng-app" 添加到两个不同的项目中,并且在这两个视图中都不再在任何浏览器中呈现.实现 IE7/8 兼容性的方式有变化吗?我使用的是 CDN 的 1.0.2 版.
This has always worked in the past, but now I've added class="ng-app" to two different projects, and in both the view no longer renders in any browser. Has the way to do IE7/8 compatibility changed? I'm using version 1.0.2 from the CDN.
谢谢.
推荐答案
编辑说明: 添加 doctype 标签会减少一些问题.谢谢@Mike Pateras
Edit note: Add doctype tag will reduce some issues. Thanks @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>
这篇关于为什么 ng-class="ng-app"打破 AngularJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文