I assume you are using unstable Angular because $ watchCollection is only in an unstable branch.
$watchCollection(obj, listener)
Shallow , - ( , - ). , .
"Angular" - .
<render collection='elements'></render>
app.directive('render', function() {
var renderFunc = function() {
console.log("model updated");
}
return {
restrict: 'E',
link: function(scope, element, attrs) {
scope.$watchCollection(attrs.collection, function(val) {
renderFunc();
});
}
}
})
Angular, true . $watch, , .
$watch(watchExpression, listener, objectEquality)
objectEquality () boolean , .
, , DOM, , . $watchCollection , , renderFunc().
Angular . , , . , .