-
Notifications
You must be signed in to change notification settings - Fork 27.5k
$timeout() doesn't update the model #1272
Comments
$timeout() has a third boolean parameter to specify whether it should invoke an $apply. |
Actually difficult value is true, so it should work, but regardless of what On Fri, Aug 17, 2012 at 2:22 PM, ItsLeeOwen [email protected]:
|
As can be seen here https://github.com/angular/angular.js/blob/master/src/ng/timeout.js#L49 $timeout calls $apply on the root scope, which might explain why the age isn't updated. |
Ignore my last comment, of course running $apply on the root scope should update all the child scopes too. Interestingly if you add I think the problem might be that because age isn't used in the template, no watch is set up and so updating it doesn't do anything. |
Bug in the compiler, I take care of it. |
This was really corner case: Watcher needs to return changed value, to notify that model might have changed and one more $digest cycle needs to be performed. The watcher, that takes care of reference binding into an isolate scope ("="), did not return changed value, if the change was from the isolate scope to the parent. If any other watcher returned change, it worked fine, as this change caused re-digest. Closes angular#1272
This was really corner case: Watcher needs to return changed value, to notify that model might have changed and one more $digest cycle needs to be performed. The watcher, that takes care of reference binding into an isolate scope ("="), did not return changed value, if the change was from the isolate scope to the parent. If any other watcher returned change, it worked fine, as this change caused re-digest. Closes #1272
$timeout() doesn't update the model in this demo while $apply() does.
http://plunker.no.de/edit/PV2Dzv?live=preview
Really weird behaviour.
The text was updated successfully, but these errors were encountered: