为什么ng-class =&"ng-app&"打破AngularJS? [英] Why does ng-class="ng-app" break AngularJS?

查看:63
本文介绍了为什么ng-class =&"ng-app&"打破AngularJS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要使AngularJS在IE7和IE8中工作,我向我的ng-app元素添加了id ="ng-app"和class ="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 =&amp;"ng-app&amp;"打破AngularJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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