我一直在按照教程在我的应用程序中实现路由
http://docs.angularjs.org/tutorial/step_07
我无法让我的版本在 IE7 中运行,并且在花了一段时间尝试找出我错过/做错的内容后,我发现该示例不起作用。
http://angular.github.com/angular-phonecat/step-7/app/
有人知道如何让它发挥作用吗?
最佳答案
好吧,我遇到了同样的问题,所以我开始了赏金,但之后我找到了可行的解决方案(至少对我来说):
- 使用 HTML5 填充程序
- 使用 JSON2.js
将所有这些属性添加到您的 html 节点:
class="ng-app:myapp"id="ng-app"ng-app="myapp"xmlns:ng="http://angularjs.org"
(其中myapp实际上是您的应用名称)
回顾一下,这是我的 IE7/8/9 工作 HTML 页面:
<!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="js/json2.js"></script>
<![endif]-->
</head>
<body>
<div ng-view></div>
</body>
</html>
关于javascript - AngularJS 路由在 IE7 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12709745/