If I have the following data structure:
Model: {
Estimates: [{
Id: 1, DataItems: [{Id: 1, Amount: 100}, {Id: 2, Amount: 200}] },
Id: 2, DataItems: [{Id: 3, Amount: 300}, {Id: 4, Amount: 400}] }
]}
How can I set up an Angular $watch to detect when any of the Amount values change?
I tried using
$scope.$watch("budget.Estimates.DataItems", function () {
console.log("Watch Fired");
});
with no luck.
Also, is there a nice, Angular way to aggregate the sum of all these Amount values?