0

My application is trying to load the angular module discApp . This is working without any issues in Chrome . But in IE11 i am getting an error like below

object doesn't support property or method 'module' .

Angular Version is using is v1.5.5. If i try ctrl+F5 its loading correctly . Is there any way to fix this issue? My Js Code where the error throwing in IE is below .

'use strict';
var discApp = angular.module('discApp', ['discApp.controllers']); //Error in this line 

Below is the code where i am adding the angular.js

<script>document.write("<script type='text/javascript' 
src='js/angular/angular.js?v=" + Date.now() + "'><\/script>");</script>
VKP
  • 589
  • 1
  • 8
  • 34
  • _"If i try ctrl+F5 its loading correctly"_ this doesn't really make sense. Under what condition does the error actually occur? – Phil Feb 19 '19 at 22:21
  • According to the [documentation](https://code.angularjs.org/1.5.5/docs/guide/ie), IE 9 through 11 is supported. Can you share more of your code? How and where are you including the `angular.js` script file? – Phil Feb 19 '19 at 22:23
  • The error occurs when i click on the link to launch the module very first time . First time i am getting the error mentioned above . After getting the error if i try ctrl+F5 module loads without any error. I modified the question with how i am including the angular.js – VKP Feb 19 '19 at 22:27
  • Why include it that way? Seems like it's just asking for issues – Phil Feb 19 '19 at 22:28
  • Earlier it was just like But later to handle the cache i changed it with document.write and Date – VKP Feb 19 '19 at 22:32
  • And does it work when you don't use `document.write()`? – Phil Feb 19 '19 at 23:20
  • Possible duplicate of [Why split the – Phil Feb 19 '19 at 23:21

1 Answers1

0

Please try to modify your code as below, and check whether it meets the same error?

'use strict';
var discApp = angular.module('discApp', []); 

If it still meets the same error, perhaps the issue is related to the angular.js reference, try to use the following script to load angular.js reference:

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js"></script>

If the error disappears, the issue is related to the 'discApp.controllers', you could check it.

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30