Nick Retallack Nick Retallack - 7 months ago 22
AngularJS Question

When AngularJS triggers an $onEval, is there any way to immediately tell what values in this scope have changed?

I want to sync changes to the server automatically. Currently I'm detecting changes in a

handler by JSON serializing the application state and comparing that to a previously serialized copy, using diff-match-patch.

I was wondering if AngularJS has anything built in to make this more efficient.

Answer Source

You could use multiple $watch'es instead of a single $onEval (note that $watch can take a function as an argument instead of a string/expression, and in version >=0.10.0 the watched values are compared using angular.Object.equals). Other than that, I don't know any AngularJS mechanism that would be useful for this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download