Lesson 5: Scope

The scope is an object that acts as a shared context between the view and the controller that allows these layers to exchange information related to the application model. Both sides are kept synchronized along the way through a mechanism called two-way data binding.

In this Lesson, we are going to cover the following topics:

  • Two-way data binding
  • Best practices using the scope
  • The $rootScope object
  • Broadcasting the scope

Two-way data binding

Traditional web applications are commonly developed through a one-way data binding mechanism. This means there is only a rendering step that attaches the data to the view. This is done with the following code snippet in the index.html file:

<input id="plate" type="text"/> <button id="showPlate">Show ...

Get AngularJS: Maintaining Web Applications 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.