AngularJS > Scope

AngularJS > Scope

In this section, we shall learn scopes of AngularJS, inheritence of scopes and isolation of scopes.

Scope works as a bridge between the AngularJS controller and the view. While executing the code, the directives set up $watch expression on the scope that allows the directive to know when the property changes and directive update its value to the HTML element. Controller and directive have reference to scope but both are not referenced in each other.

Scope has mainly two APIs that helps it to update the directive and model

  1. $watch - it helps Scope to observe the model changes

  2. $apply - it helps Scope to update the model changes to the view (directive)

Scope can be nested, to know more about it read this post.

To learn basics of how Scope works, read following posts of Data binding.

Read posts under AngularJS > Scope

2 posts found
  1. Controller scope Inheritence
  2. Isolating custom directive scope

Write for us

Hosting Recommendations