I have data as follow:
$scope.form= response.data.shooter;
oldData= response.data.shooter;
I have an issue in here:
Both have the same object array.
When I delete any value from oldData, it is also getting removed from $scope.form.
The code is as follows:
$.each(oldData, function(i, e) {
console.log(oldData[e], $scope.form[e]);
oldData[e] = '';
console.log(oldData[e], $scope.form[e]);
});
I have searched regarding this, but no luck.
Can anyone tell me, how to create a replica of scope to handle it separately regardless of sync between two array objects i.e. independent replica of scope so that if I make changes in that replica should not affect in scope?