I'm facing an issue in my AngularJS project where I can't share copied object data between different controllers.
While I can successfully share data by setting properties in code, copying the object seems to cause a problem.
In the provided code snippet on JSFiddle, you'll find two objects named User
and OriginalUser
.
Upon loading the FirstCtrl
, I copy the contents of User
into OriginalUser
.
Although the value assigned to User
object in FirstCtrl
is accessible in SecondCtrl
, the data within OriginalUser
is only available in FirstCtrl
.
To see this behavior firsthand, visit the live demo on JSFiddle Code Sample