The Scope Life Cycle

Scope data goes through a life cycle while the application is loaded in the browser. Understanding this life cycle will help you understand the interaction between scope and other AngularJS components, especially templates.

Scope data goes through the following life cycle phases:

1. Creation

2. Watcher registration

3. Model mutation

4. Mutation observation

5. Scope destruction

These life cycle phases are described in the sections that follow.

The Creation Phase

The creation phase occurs when a scope is initialized. Bootstrapping the application creates a root scope. Linking the template creates child scopes when ng-controller or ng-repeat directives are encountered.

Also during the creation phase, a digest loop is created ...

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.