Whenever I attempt to duplicate a new object into an old object using angular.copy
, the reference changes. If I try using =
or
JSON.parse(JSON.stringify(newObj))
, the view does not reflect the new value.
Is there a solution to this issue?
Here is a code example:
$scope.value = newValue.ref;
In this case, the view does not update.
$scope.value = angular.copy(newValue.ref);
When doing this, the view updates, but the reference changes.