O'Reilly logo

AngularJS: Maintaining Web Applications by Amos Q. Haviv, Matt Frisbie, Chandermani, Rodrigo Branas

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

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

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