You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I need to be notified, once, when all model changes that are caused by either a user event, or a call to $apply, have completed. In other words, when the model has stabilized. The AngularJS user mailing list recommended to pass the listener as the first argument to $watch, and not passing a watchexpression.
"If you want to be notified whenever $digest is called, you can register an watchExpression function with no listener. (Since watchExpression, can execute multiple times per $digest cycle when a change is detected, be prepared for multiple calls to your listener.)"
If you have 'no listener', how can you have 'multiple calls to your listener'?
In any event, as the pluncker shows, I'm getting two calls per model change. (I'm guessing once after the model changed, and a second even though it hasn't changed subsequently.)
I would like a means to be notified when a model update cycle completes, and be notified only once. My use case is to persist the model to localStorage to create immediate persistence (e.g. no 'Save' button).