When Angular.JS 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 scope.$onEval handler by JSON serializing the application state and comparing that to a previously serialized copy, using diff-match-patch.

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


ANSWERS:


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.


I am working on something similar. Like @psyho suggested I am using $watch to catch the changes.

scope.$watch("dataObject",function (newValue, oldValue) {
    //calculate changes
    //send the changes to the server
});

I then use the logic from jquery diff to calculate what changes were made.



 MORE:


 ? When Angular.JS triggers an $onEval, is there any way to immediately tell what values in this scope have changed?
 ? When Angular.JS triggers an $onEval, is there any way to immediately tell what values in this scope have changed?
 ? Is there any way to provide a default value for an isolated scope alias?
 ? Maintain model of scope when changing between views in AngularJS
 ? Angular.js: Is .value() the proper way to set app wide constant and how to retrieve it in a controller
 ? Angularjs: input[text] ngChange fires while the value is changing
 ? AngularJS Trigger ng-animate when binding value change
 ? Angular.js - elegant way to use functions in scope
 ? What is the correct way to handle $scope state and values when changing views in Angular.js
 ? Angular.js $scope.$on initial value