Thanks Eric, I actually initially had the loop running outside, but because the view uses data-binding in its styles, having it outside meant that the values changed but the view wouldn't update unless I ran the assignment operations wrapped inside a `zone.run`
On Sun, Oct 25, 2015 at 11:20 PM, Eric Martinez <[email protected]> wrote: > Chang, > > I've been playing with this in it seems that window.requestAnimationFrame > is causing change detections. I base this assumption in this comment > https://github.com/angular/angular/pull/3876#issuecomment-135894296, also > I did a little test to see if I'm right or not > > I added the following code > > afterViewChecked() { > console.log('I\'m being checked!'); > } > > > tick () { > var c = ++this.count; > this.top = Math.sin(c / 10) * 10; > this.left = Math.cos(c / 10) * 10; > this.color = c % 255; > this.content = c % 100; > window.requestAnimationFrame(() => this.tick()); > } > > afterViewChecked is called everytime the view is being checked, and if you > see the console the log grows, and grows, and grows, and grows... I know > that a solution could be running it outside angular using > zone.runOutsideAngular(() => ...), I tried it and I failed. > > I know this is not a solution, but I hope it gives you at least a clue of > how to solve it. > > PS : Here's a plnkr with my little test > http://plnkr.co/edit/bhy6apYuPHAW5WoEFxey > > Regards. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
