Implementing Scope Hierarchy
A great feature of scopes is that they are organized in a hierarchy. The hierarchy helps you keep scopes organized and relevant to the context of the view they represent. There is a root scope at the AngularJS module level and then child scopes can be implemented in sub-components such as controllers or directives. Child scopes can be nested within each other creating a hierarchy structure.
Note
The $digest()
method uses the scope hierarchy to propagate scope changes to the appropriate watchers and the DOM elements.
Scope hierarchies are created automatically based on the location of ng-controller
statements in the AngularJS template. For example, the following template code defines two <div>
elements that create ...
Get Learning AngularJS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.