angular-carousel
angular-carousel copied to clipboard
Errors with Angular 1.3
When a ngIf
directive resolves to false
on a rn-carousel
element, angular-carousel crashes with the following error in loop:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: cspSafeGetter; newVal: -1; oldVal: 0"],["fn: cspSafeGetter; newVal: 0; oldVal: -1"],["fn: cspSafeGetter; newVal: -1; oldVal: 0"],["fn: cspSafeGetter; newVal: 0; oldVal: -1"],["fn: cspSafeGetter; newVal: -1; oldVal: 0"]]
http://errors.angularjs.org/1.3.2/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3A…5B%22fn%3A%20cspSafeGetter%3B%20newVal%3A%20-1%3B%20oldVal%3A%200%22%5D%5D
at http://localhost:9000/bower_components/angular/angular.js:80:12
at Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:14080:19)
at Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:14304:24)
at done (http://localhost:9000/bower_components/angular/angular.js:9518:47)
at completeRequest (http://localhost:9000/bower_components/angular/angular.js:9703:7)
at XMLHttpRequest.requestLoaded (http://localhost:9000/bower_components/angular/angular.js:9646:9)
On line 537 of the dist file (var oldSlides = (currentSlides || newValue).slice();
) we also need to check for undefined
values:
TypeError: Cannot read property 'slice' of undefined
at http://localhost:9000/bower_components/angular-carousel/dist/angular-carousel.js:537:76
at Object.$watchCollectionAction [as fn] (http://localhost:9000/bower_components/angular/angular.js:13907:13)
at Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:14042:29)
at Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:14304:24)
at done (http://localhost:9000/bower_components/angular/angular.js:9518:47)
at completeRequest (http://localhost:9000/bower_components/angular/angular.js:9703:7)
at XMLHttpRequest.requestLoaded (http://localhost:9000/bower_components/angular/angular.js:9646:9)
I am also getting the second error on my local machine. Unfortunately, I can't reproduce it on Plunker: http://plnkr.co/edit/x5MDsmHRcG9V1hDUkGeL?p=preview
Is there any quick fix for this?
Unfortunately the first error happens with Angular 1.2 as well.
Please visit this Plunker to see it in action: http://plnkr.co/edit/kKD4kOuomBiPjky3ofED?p=preview
If you comment the directive test-slide
and use the li
element directly, the error goes away.
Hi @revolunet, have you had the time to look at this issue?
Ran into same issue today - Angular 1.3.x
I have the second error as well. My version number is 1.2.28.
Me too I have the same error, it's appear when we load in asynchrous the data like ajax call. When I populate directly the slides with $scope.slides = {slide1, slide2 ...} I have no issue.
I have the same error. As matohawk said, i load the data asynchronous.
We are using a#1.3.11. We had similar problem whenever the carousel were empty (including async data loading). We have added ng-if="dataSetNotEmpty" above the rn-carousel and this solves the issue.
thanks. @equus71 it works!
Thanks @equus71. It works, the error is gone.