AngularJS : Using AngularJS in Internet Explorer 7

This page last changed on Mar 22, 2013 by admin.

In order to let AngularJS run properly in IE7 we need to take the following steps.

Add the JSON stringify polyfill

<!--[if lte IE 7]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js"></script>
<![endif]-->

Make sure to load this before Angular gets loaded.

Add additional markup

The ng-app attribute should be put in the body tag instead of the html tag and have an additional id:

<!-- id is needed for IE7 -->
<body ng-app="angularNuSiteApp" id="ng-app">

The view tag should be accompanied by an extra class:

<!-- class ng-view is needed for IE7 -->
<div ng-view class="ng-view container"></div>

And finally

We should add a message urging the user to upgrade to a decent browser so our could is no longer polluted (wink).