AngularJS is undefined in IE8 AngularJS is undefined in IE8 angularjs angularjs

AngularJS is undefined in IE8


I've been working with IE8 for six months now, feel your pain.

Without seeing your code it's hard exactly to say what's wrong

Here's a very very basic page I just tested with IE8, for you to compare against:

<!DOCTYPE html><html lang="en"><head><meta http-equiv="X-UA-Compatible" content="IE=8">    <meta charset="utf-8">    <title>Prompt Detail View</title>    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <meta name="description" content="">    <meta name="author" content="">    <!-- disable browser cache -->    <meta http-equiv="cache-control" content="max-age=0" />    <meta http-equiv="cache-control" content="no-cache" />    <meta http-equiv="expires" content="0" />    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />    <meta http-equiv="pragma" content="no-cache" />    <!--[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]-->    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->    <!--[if lt IE 9]>          <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>        <![endif]-->    <script src="js/jquery-1.7.2.min.js"></script>    <script src="js/angular-1.0.2.js" ng:autobind></script><script>var pageModule = angular.module('pageModule',[]).controller('pageCtrl',function($scope) {   $scope.foo = 'my foo'; });</script></head><body>    <div ng-app="pageModule"        ng-controller="pageCtrl">            {{foo}}    </div></body></html>


So this was totally my bad (or the guy that started this app months ago).

My application controller had var angular = angular || {} at the top, IE8 didn't agree with this declaration.

After removing that all is well.


I also had the same issue, my IE9 browser didn't recognize any AngularJs tag, after trying everything I decided to run the html file in a server and it worked.

To summerize, when I executed the file as follows it didn't work

file:///C:/AngularJS/firstTest.html

when I executed the file in the server as follows it did work

http://localhost:7001/AngularJS/firstTest.html