O'Reilly logo

Learning AngularJS by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required