Apologies if this has been asked before, I couldn't find anything on SO and I'm hoping for some clarification ( or a nice neat trick )
Given
<div ng-controller="Parent">
<div ng-controller="Child">
//child manipulation of parent scope object
</div>
</div>
Parent sets json object so it is available to multiple child scopes -
$scope.persistentData = getAJSONObject();
A child scope wants to do some calculations and update a key of the local json object it has inherited from the parent -
doCalculations( $scope.persistentData.keyIWantToAlter )
Do I need to explicitly assign the parent scope to the result of the calculation function in the child (shown below) or is there a way that I can propogate the changes to the parent scope by just using the child's inherited scope objects?
$parent.$scope.$persistentData.keyIWantToAlter =
doCalculations( $scope.persistentData.keyIWantToAlter)
getAJSONObjectasync ?doCalculationsare you do anything like$scope.persistentData = ...