Here I will be trying to put snippets of AngularJS code, which may help during the work.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Whenever dealing with the objects & doing assignments, always make the copy & never do the assignment directly like shown below -
$scope.user = angular.copy($scope.master);
Here user & master are objects & while making the assignments, copy is being created rather doing below -
$scope.user = $scope.master;
Both look good, but issue is that now both are having the same address & any change in one object will change the other too, which you may not be expecting.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Whenever dealing with the objects & doing assignments, always make the copy & never do the assignment directly like shown below -
$scope.user = angular.copy($scope.master);
Here user & master are objects & while making the assignments, copy is being created rather doing below -
$scope.user = $scope.master;
Both look good, but issue is that now both are having the same address & any change in one object will change the other too, which you may not be expecting.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------