I feel like I'm overlooking a simple solution.
Within my $scope
, I have an object. Now, I want to rename one of its properties.
Let's say I currently have:
$scope.data = { prop1: value1, prop2: value2}
My goal is for the object to look like this:
$scope.data = { newProp: value1, prop2: value2}
I attempted:
$scope.data.prop1 = newProp;
delete $scope.data.prop1;
Unfortunately, I did not achieve the desired result.
How can I correctly update an Angular data object in this scenario?
Thank you
UPDATE
Additional information:
I tried updating this object from a child controller using $scope.$parent.data