Sunday, 24 January 2016

Friday, 29 May 2015

Angular const vs value


Angular $evalAsync vs $timeout

$evalAsync runs within the digest cycle, before the watchers are processed, so will be performed earlier than if you use $timeout.

$evalAsync from a directive, should run after the DOM has been manipulated by Angular but before the browser renders.

$evalAsync from a controller, should run before the DOM has been manipulated by Angular (and before the browser renders) -- rarely do you want this.

$timeout, should run after the DOM has been manipulated by Angular and after the browser renders (which may cause flicker in some cases).