为了确保AngularJS是否能在我需要的浏览器上运行,我做了一个简单的数据绑定演示,它在火狐、Chrome和IE8+上都运行得很好,但我也需要让它在IE7上运行。不幸的是,我不能让它在上面工作。它只显示带大括号的html,忽略了ng-
属性。
我已经检查了I浏览器上的several posts about AngularJS,并尝试了每个版本的建议修复程序,但在我的演示中都不起作用。
这是我演示的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>
这是包含控制器和模型的test.js javascript:
function serversCtrl($scope, $http, $location) {
$scope.texto = "Texto dinamico";
$scope.items = [
{col1: "foo1", col2: "bar1", col3: "baz1"},
{col1: "foo2", col2: "bar2", col3: "baz2"},
{col1: "foo3", col2: "bar3", col3: "baz3"},
{col1: "foo4", col2: "bar4", col3: "baz4"},
{col1: "foo5", col2: "bar5", col3: "baz5"}
];
}
我做错了什么吗?有没有其他的技巧可以让它工作,我错过了?
编辑:我使用的是AngularJS v1.0.5
https://stackoverflow.com/questions/15914675
复制相似问题