How to update an array element?

Start at the end of the issue. You need to update only those array elements that have changed. You cannot update the entire array!


$scope.getData = function() {
 $http.get('/api/arr/', {
 cache: true
 }).then(successCallback, errorCallback);

 function successCallback(response) {
 if ($scope.arr== null) {
 $scope.arr= [];
// but what to do if you want to upgrade?
//tried to do so:

 for (var i = 0; i < $scope.arr.length; i++) {
if ($scope.arr[i].name![i].name) {


doing a get request every second on a timer, but despite this, never the condition the $scope.arr[i].name![i].name because why the data is the same as if I have the same link. Although the merge should work otherwise.

How to upgrade a single item of the array without refresh the entire array with a get request?

The third day I already, does not work. Very helpful would be an example. Thank you!
June 14th 19 at 20:36
3 answers
June 14th 19 at 20:38
He decided, needed angular.copy to use.
June 14th 19 at 20:40
If you do it in ng-repeat then you put something worth trackBy to put some custom.
Well generally 1. angular.merge deprecated, 2. call it for Merja arrays - some tin
June 14th 19 at 20:42

Find more questions by tags Angular