Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Internet Explorer 7上运行AngularJS应用程序_Javascript_Angularjs_Internet Explorer 7 - Fatal编程技术网

Javascript 在Internet Explorer 7上运行AngularJS应用程序

Javascript 在Internet Explorer 7上运行AngularJS应用程序,javascript,angularjs,internet-explorer-7,Javascript,Angularjs,Internet Explorer 7,为了确保AngularJS是否能在我需要的浏览器上运行,我制作了一个简单的数据绑定演示,它在Firefox、Chrome和IE8+上运行良好,但我还需要让它在IE7上运行。不幸的是,我不能让它工作。它只显示带有大括号的html,忽略ng-属性 我已经在Internet Explorer上进行了检查,并在每个浏览器上尝试了建议的修复,但在我的演示上没有任何效果 这是我的演示的HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transiti

为了确保AngularJS是否能在我需要的浏览器上运行,我制作了一个简单的数据绑定演示,它在Firefox、Chrome和IE8+上运行良好,但我还需要让它在IE7上运行。不幸的是,我不能让它工作。它只显示带有大括号的html,忽略
ng-
属性

我已经在Internet Explorer上进行了检查,并在每个浏览器上尝试了建议的修复,但在我的演示上没有任何效果

这是我的演示的HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Angular IE7 Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!--[if lt IE 9]>
<script type="text/javascript" src="angularjs/html5shiv.js"></script>
<![endif]-->
<!--[if lt IE 8]>
<script type="text/javascript" src="angularjs/json3.js"></script>
<![endif]-->
<script language="JavaScript" src="angularjs/angular.min.js"></script>
<script language="JavaScript" src="angularjs/test.js"></script>
</head>
<body class="ng-app">
    <div ng-controller="serversCtrl">
        <p>{{texto}}</p>

        <table border="1">
            <tbody>
                <tr><th>Col1</th><th>Col2</th><th>Col3</th></tr>
                <tr ng-repeat="item in items"><td>{{item.col1}}</td><td>{{item.col2}}</td><td>{{item.col3}}</td></tr>
            </tbody>
        </table>
    </div>
</body>
</html>
我做错什么了吗?有没有其他我错过的让它发挥作用的技巧

编辑:我正在使用AngularJS v1.0.5

1)将
id=“ng app”
添加到您的身体标签中

<body ng-app="myApp" id="ng-app">


2) 通知您的用户/客户,现在是2013年。

再多读一点,我就能让它工作了

IE7的问题在于引导。它没有开火!因此,我进行了一次手动初始化,如中所示,它成功了

这是我添加到HTML中的代码,确保它只在Internet Explorer 8或更低版本上启动(因为如果我为所有浏览器启动它,一些事件处理程序会为非ie浏览器启动两次):



$document.ready()
部分是jQuery的一种方式,可以确保在主体上的所有内容都已加载时执行此代码,但由于我在我的站点上使用了jQuery,所以我利用了它。

实际上我也尝试使用id=“ng app”作为class=“ng app”的替代方案,但没有一个解决我的问题。不幸的是,在我的国家(萨尔瓦多),人们仍然使用Windows XP和Internet Explorer 6和7,但我们正在说服他们升级。感谢您的回答。
id=“ng app”
并非替代方案。两者都是必需的,
ng-app=“myApp”
id=“ng-app”
@RobertoLinares-我以为他们在美国境外只使用Linux和Firefox@AdamNofsinger根据我网站上的用户代理日志,这里仍然有很多用户在使用IE6和IE7,特别是政府/大公司用户。Angular seed的最新版本有
,单独使用就可以了吗?你能给我举一个JSFIDLE或Plnkr的例子吗?我不能让他工作,我真的很希望有一个工作的例子。
<body ng-app="myApp" id="ng-app">
<!--[if lte IE 8]>
<script type="text/javascript">
    $(document).ready(function() {
        angular.bootstrap(document);
    });
</script>
<![endif]-->