While studying the ng-book, there is a section that recommends encapsulating attributes within another attribute when using the $scope
, as shown below:
$scope.model.attribute
instead of $scope.attribute
The author points out that this practice is beneficial when dealing with nested controllers because if we don't follow this approach, changes made in the child $scope will not reflect in the parent $scope.
I am struggling to grasp why this is necessary. What sets $scope.model.attribute
apart from $scope.attribute
in terms of prototypal inheritance?