AngularJS Routing not working in IE7

后端 未结 1 722
臣服心动
臣服心动 2020-12-12 19:42

I have been implementing Routing in my app following the tutorial

http://docs.angularjs.org/tutorial/step_07

I couldn\'t get my version to work in IE7, and a

相关标签:
1条回答
  • 2020-12-12 20:11

    OK I had the same problem so I started the bounty, but after that I found the working solution (for me at least):

    • Use HTML5 shim
    • Use JSON2.js
    • Add all these attributes to your html node:

      class="ng-app:myapp" id="ng-app" ng-app="myapp" xmlns:ng="http://angularjs.org"

    (where myapp is really your app name)

    So to recap, here is my IE7/8/9 working HTML page:

    <!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>
    
    0 讨论(0)
提交回复
热议问题