Angular js ie 7,8 兼容性

Angularjs  官網有云:javascript

1)在html 裏面 ,有ng-app 的標籤裏須要定義個id ,id='ng-app';html

2)ie 7及如下版本須要json2.js或json3.js,主要用來解析jsonjava

3)ie8 如下須要自定義一些指令標籤: ng-include,ng-pluralize,ng-view,ng:include,ng:pluralize,ng:view;json

綜合以上咱們把代碼總結爲:app

<!DOCTYPE html>
<html lang="en" ng-app="phonecat" id="ng-app">
<head>
    <!--[if lte IE 7]>
    <script src="js/json2.js"></script>
    <![endif]-->
    <!--[if lte IE 8]>
    <script>
        document.createElement('ng-include');
        document.createElement('ng-pluralize');
        document.createElement('ng-view');

        // Optionally these for CSS
        document.createElement('ng:include');
        document.createElement('ng:pluralize');
        document.createElement('ng:view');
    </script>
    <![endif]-->
</head>
</html>

  經實踐中證實,it's very right !htm

相關文章
相關標籤/搜索