This is a common problem:
5 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
The docume
For me the error was happening in a method changing the url:
> self.setURL = function(item) {
>
>
>//Ajax call followed by promise function
> servicejsfile.somefunctiom(transferObj).then(responce){
>
> var somethingTrue=responce.featureAvailable;
>if (somethingTrue) {
> dothis();
>}else
> $window.location = newlocation;
> };
This change the last portion of URL of my application. this was causing the $rootScope:infdig error
So when debugging this, I commented out this portion, and error was not repeated along with requirement of application also changed.
I am not able to fix this so we requirement remains same and I can change the location.
This issue is taking place from some a Ajax call inside a funtion of a controller, and only in IE For FF , chrome and safari it is behaving perfect as JavaScript engine is faster for these browsers.
question was already answered here - How to Troubleshoot Angular "10 $digest() iterations reached" Error
as a resume of two best answers:
plus
you can always put conditional breakpoint here https://github.com/angular/angular.js/blob/c3220325a0a95484724a03bedca24e1bbf05dc80/src/ng/rootScope.js#L815 to check the exception stacktrace.
There can be multiple reasons to it. One of the common reason I've faced is due to a filter in the ng-repeat
which returns a new array to work on the ng-repeat
.
So check your ng-repeat
expressions which have associated filters which is modifying the array.
For me the error was happening in a method changing the url:
self.setURL = function(item) {
var mainUrl = window.location.origin + '#/' + self.baseUrl;
if (item) {
mainUrl += item.testId;
}
$location.$$absUrl = mainUrl;
};
this was causing the $rootScope:infdig
error
So when debugging this check whatever is changing your ur, location, hrefs in your current controller/directive