AngularJS menemukan dan memperbarui objek dalam 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
JumpRoper