Using the following code:
<div ng-controller="mainCtrl">
<div ng-repeat="record in records" ng-controller="itemCtrl">
<span>{{record}}</span><a ng-click="inc()">inc</a>
</div>
<p></p>
<div ng-repeat="record in records2">
<span>{{record}}</span><a ng-click="inc()">inc</a>
</div>
</div>
var mainCtrl = function($scope){
$scope.records = [
{ val: 1},
{ val: 2},
{ val: 3},
];
$scope.records2 = [1, 2, 3];
}
var itemCtrl = function($scope) {
$scope.inc = function() {
$scope.record.val++;
};
}
var itemCtrl2 = function($scope) {
$scope.inc = function() {
$scope.record++;
};
}
I expect the "inc" links to increment both types of records. However, it seems 2-way binding is only working here for the 1st type of record (where it's an object and I update a property on it). I've seen some mentions of similar problems and got the impression there is a problem with changing the actual bound object. Is this really the case? If so, I do believe it to be a missing feature.