I\'m working on an edit form (user.html) that PUTs data to an API, but I\'d like to avoid PUTting all the data in the form. I\'d like to PUT just the changed items.
old thread but to build on TheSharpieOne's answer, you may want to check for equality using angular.equals instead of "===" otherwise this won't work for arrays.
function findDiff(original, edited){
var diff = {}
for(var key in original){
if(!angular.equals(original[key], edited[key]))
diff[key] = edited[key];
}
return diff;
}