Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angularjs find and update object in array

//$scope.customers is a list of customers
// o is a response of PUT request which will be return customer updated object
var x = $scope.customers.find(x => x._id === o.data.customer._id)
var index = $scope.customers.indexOf(x)
$scope.customers[index] = o.data.customer
 
PREVIOUS NEXT
Tagged: #angularjs #find #update #object #array
ADD COMMENT
Topic
Name
9+2 =