I have two arrays (scope variables) whose values are getting updated dynamically, but in the HTML when I am trying to print their values, the view is not taking the updated ones.
<div>
<!-- array printing -->
<span ng-repeat="var in array track by $index">{{var}}</span>
</div>
<div>
<!-- array -->
<span ng-repeat="var in array2 track by $index">{{var}}</span>
</div>
When I am printing the values in the console log, the array is changing but its changes are not getting reflected in the page.
controller.js
$scope.update = function() {
$scope.array.push(box);
// inside an ajax call
var index = $scope.array.indexOf(box);
if(index > -1) {
$scope.array.splice(index,1);
console.log("index "+index);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.