$scope对象上的$watch方法会给Angular事件循环内的每一个$digest调用装配一个脏值检查。若是在表达式上检测到变化, Angular老是会返回$digest循环。angularjs
http://stackoverflow.com/questions/17301572/angularjs-evalasync-vs-timeout
To summarize:
if code is queued using $evalAsync from a directive, it should run after the DOM has been manipulated by Angular, but before the browser renders
if code is queued using $evalAsync from a controller, it should run before the DOM has been manipulated by Angular (and before the browser renders) -- rarely do you want this
if code is queued using $timeout, it should run after the DOM has been manipulated by Angular, and after the browser renders (which may cause flicker in some cases)app
http://blog.csdn.net/dm_vincent/article/details/38705099
若是你在AngularJS上下文以外的任何地方修改了model,那么你就须要经过手动调用$apply()来通知AngularJS。这就像告诉AngularJS,你修改了一些models,但愿AngularJS帮你触发watchers来作出正确的响应。async