For the problem at hand, take a look at this link: http://plnkr.co/edit/ZphAKvZeoVtuGFSEmOKg?p=preview
Imagine you have an array structured like this:
var arr = [
{
'a': "123",
'b': "654"
},
{
'a': "456",
'b': "321"
}
];
arr.foo = 'bar';
$watch
will trigger when there are changes made to the objects within (for example arr[0].a = 'hoopidoo'
), yet it won't detect changes to foo
(like arr.foo = 'deedlilaa'
, or via ng-model
). This could be due to a limitation in JavaScript. When iterating through the array, only the objects are returned, and therefore foo
cannot be enumerated.
View the plunker for further clarification. The watch event does not get triggered regardless of input modifications or controller actions.