angularjs - 10 $digest() iterations reached. Aborting -


i'm receiving error message , video tag reloading every time try click on or use scrubber bar. why? heard message if alter variable in directive directive watching. makes sense, if comment out line scope.state.tutorialnumber++ makes no difference. missing?

html

<video ng-click="clickpause()" poster="./poster.png" video-watcher class="video-js vjs-default-skin" id="myvideo" congrats="state.questionnumber" video-loader="[state.tutorialnumber, state.sectionnumber]" id="video" controls>     <source type="video/mp4" src="{{sections[state.sectionnumber].tutorials[state.tutorialnumber].name}}.mp4"></source>     <source type="video/webm" src="{{sections[state.sectionnumber].tutorials[state.tutorialnumber].name}}.webm"></source>     browser not support video tag. </video> 

and directive

app.directive('videowatcher', function ($location) { return function (scope, video, attrs) {     scope.$watch(attrs.videoloader, function () {         $(video[0]).bind('ended', function () {             $(this).unbind('ended');             if (!this.ended) {                 return;             };             var url = "/"+sections[scope.state.sectionnumber].name +"/"+ scope.state.tutorialnumber++;             $location.path(url);             scope.$apply();         });         setpause(scope.sections[scope.state.sectionnumber].tutorials[scope.state.tutorialnumber].pause);         video[0].load();         video[0].play();     });     scope.$watch(attrs.congrats, function(){         if (scope.state.questionnumber === scope.sections[scope.state.sectionnumber].tutorials[scope.state.tutorialnumber].material.length){             video[0].play();             settimeout(function () {                 video[0].play();             }, 500);         }     }); }; }) 

edit: ok, if comment out first $watch don't error if comment code out inside of first watch error. seems fact i'm watching array [state.tutorialnumber, state.sectionnumber]. thought fine. fact i'm using angular 1.0.4?

i solved problem adding third parameter $watch objectequality boolean.

$watch(attrs.videoloader, function(){...}, true) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -