Problem:
I am trying to download an Angular JS application in a bootable modal panel and it displays strange behavior in Internet Explorer (we tested it on IE9 and 8).
we found that the following errors were received:
** 'JSON' undefined ** object Concerned
SCRIPT5022: 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [["fn: function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }; newVal: 7; oldVal: 6"],["fn: function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }; newVal: 8; oldVal: 7"],["fn: function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }; newVal: 9; oldVal: 8"],["fn: function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }; newVal: 10; oldVal: 9"],["fn: function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }; newVal: 11; oldVal: 10"]]
and many other mistakes
So, we found that there are 3 problems on IE: 1) JSON is not available 2) Problem with the Bootstraping application 3) Viewing the rendering of the problem
after going through Angular JS documentation and a lot of threads from StackOverflow, for example:
We found that for all threads there are several common ones (also mentioned in the AngulaJS IE manual): * Enable JSON2 / JSON3 pollyfills for IE * use ie-shiv and pre-declare custom tags (we use a custom typeahead directive with the restriction: "E" , replace: true) * use other special IE instructions
So, I made the following chagnes:
var markup = '<div id="ng-app" class="ng-app:myapp" ng-app="myapp" xmlns:ng="http://angularjs.org"><div ng-controller="MyAppAppCtrl"><div ng-view></div></div></div>'; jQuery('#works-modal').html(markup); angular.bootstrap(jQuery('#ng-app'), ['myapp']); jQuery('#works-modal').modal('show');
After doing the above changes, I still got:
Error: 10 $digest() iterations reached. Aborting!
https://github.com/angular/angular.js/issues/1417
When trying to visualize viewing, the application was redirected to the home page. so I tried to make the changes suggested in:
https://github.com/RobbinHabermehl/angular.js/commit/c801f91a25b9be6f5b1163c012e63c84cc6a1359
Now I no longer get the error when I click the link to display the Modal dialog, it displays a pop-up window per second and then redirects to the main page.
If I install:
$locationProvider.html5Mode(false) .hashPrefix('!');
It works great. Does anyone encounter a similar problem? Any help is appreciated.
Update I also reported this problem in the Angular JS Github error list, they informed me that they fixed this problem in version 1.2:
https://github.com/angular/angular.js/issues/3397
I will check and update this thread if this solves my problem.
Update
I updated my version of Angular, and it seems to allow this โ 10 $ digest () iteration achieved. Aborting! โ, However it looks like it causes the URL to change, it redirects to the home page.
Let me explain my scenario here so that others can suggest to me if this is exactly related to this or not:
I have a page: http://example.com/users/myCollection.html On this page, I load the AngularJS application inside the Bootstrap Modal dialog box when a user clicks on any link on the page. Angular application route loaded in Modal: / mywork / find
After updating the Angular version, now the modal seems to load the application for a second, then redirect, and it goes to the home page.
FYI , I also use jQuery on the page that is used to run the Angular application, is there any chance of a conflict because of this?
Thanks Ravish