O'Reilly logo

AngularJS: Novice to Ninja by Sandeep Panda

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

Chapter 3AngularJS Scope & Events

Scope Demystified

You have been listening me talk about scopes from the beginning of the book. But now (drum roll, please!) we're going to demystify the AngularJS scope.

Essentially, a scope is nothing but a plain old JavaScript object, and that is just a container for key/value pairs, as follows:

var myObject={name:'AngularJS', creator:'Misko'}

A scope—like other objects—can have properties and functions attached to it. The only difference is that we don't usually construct a scope object manually. Rather, AngularJS automatically creates and injects one for us.

In the Angular world, a scope object is useful for holding model values, which are presented by the view. In our previous example, we attached properties ...

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