I am trying to create animation on some phrases that will be displayed on the main page of the site, in an arbitrary position and with fading and broadcast effects.
I would achieve this by using the ng-style attribute inside the ng-repeat attribute and setting the ng-style value to call the JavaScript function defined inside the HomeController.
Using this reason, angular is called to throw an exception: $ rootScope: error infdig 10 $ digest () iterations. Aborting! Observers fired in the last 5 iterations
I read so much about this, but not a single solution resolved my case. Can anybody help me?
Here is the part of index.html:
<div class="phrasesContainer" animate-phrases=""> <h3 class="flying-text" ng-repeat="phrase in Phrases" ng-style="getTopLeftPosition()">{{phrase}}</h3> </div>
Here is the controller function:
$scope.getTopLeftPosition = function() { var top = randomBetween(10, 90); var left = getRandomTwoRange(5, 30, 70, 80); return { top: top + '%', left: left + '%' };
}
Here is a demo: http://plnkr.co/edit/8sYks589agtLbZCGJ08B?p=preview
javascript jquery angularjs angularjs-rootscope ng-style
Androidian
source share