I have the following 2 arrays $scope.oldArray & $scope.newArray
$scope.oldArray = [{
"status": "New",
"priority_summary": "High",
"u_id" : 1
}, {
"status": "New",
"priority_summary": "High",
"u_id" : 2
}, {
"status": "New",
"priority_summary": "High",
"u_id" : 3
}, {
"status": "New",
"priority_summary": "High",
"u_id" : 4
}];
$scope.newArray = [{
"status": "Old",
"priority_summary": "Low",
"u_id" : 1
}, {
"status": "Old",
"priority_summary": "High",
"u_id" : 2
}, {
"status": "New",
"priority_summary": "Low",
"u_id" : 3
}, {
"status": "New",
"priority_summary": "High",
"u_id" : 4
}];
Here I need to compare these 2 arrays, then delete the changed object in $scope.oldArray & add the changed object from $scope.newArray to $scope.oldArray.
Note: Should not replace all the values from $scope.newArray to $scope.oldArray.