2014-02-25 143 views
2

我有我试图在IE 8 显示AngularJS页工作下面是我的HTMLAngularJS不会在Internet Explorer 8

<html id="ng-app" ng-app=""> 
<head> 
<script type='text/javascript' src='http://cdnjs.cloudflare.com/ajax/libs/json3/3.3.0/json3.min.js'></script> 
<script src="http://docs.angularjs.org/angular.min.js"></script> 
</head> 
<BODY ng-app=""> 
<script type="text/javascript"> 
function cstScope($scope) { 
    $scope.LEVEL = "x1  "; 
    $scope.change = function() { 
     alert("changed"); 
    }; 
} 
</script> 
<div ng-controller="cstScope"> 
<input type=text ng-model="LEVEL" ng-change="change()"></input> 
</div> 
</BODY> 
</html> 

当页面加载与

它倒下
Line: 30 
Error: [$sce:iequirks] http://errors.angularjs.org/1.2.14-build.2316+sha.24fe163/$sce/iequirks 

我曾尝试添加JSON3和ieshiv,但没有运气。

+0

看看这个问题http://stackoverflow.com/questions/18506458/sceiequirks-strict-contextual-escaping-does-not-support-internet-explorer-ve。 –

回答

11

页眉标记中添加这个元标记

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 

样子

<head> 
    <meta charset="utf-8"> 
    <title>Sample App</title> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
</head> 

我希望,它可以帮助你。欢呼的...

+1

优秀的答案,谢谢。但是你也需要版本<2.0的jquery。我在下面的评论中发布了完整的解决方案,它对我有效。 – raj

+1

优秀的答案@Ramesh Rajendran。它的工作就像一个魅力。 – Jeba

+0

@raj为什么我们还需要jquery的<2.0版本呢?这取决于你正在使用的角度版本?根据angular 1.3的faqs [link](https://docs.angularjs.org/misc/faq),建议您只使用jquery verion> = 2.1。 也可以请让我知道你从哪里得到这些信息?谢谢 – Kholofelo

0

只是在这里拍摄,但请确保您没有打开兼容模式。我浪费了一些时间来处理类似的错误,当我打算点击刷新按钮时,不小心点击了兼容性按钮。

0

为Angularjs在Internet Explorer中正常工作,你还需要2.0以下的jQuery版本。这是适合我的解决方案。

<head> 
<!--[if lt IE 9]> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
    <script type="text/javascript" src="../../js/jquery.1.9.0.min.js"></script> 
<![endif]--> 
<!--[if gte IE 9]><!--> 
    <script type="text/javascript" src="../../js/jquery.2.0.min.js"></script> 
<!--<![endif]--> 
<title>App Title</title> 
<script type="text/javascript" src="../../js/angular.min.js"></script> 
<script type="text/javascript" src="../../js/jquery.plugin.min.js"></script>