Understanding the scope in angularjs

Let us now look at this thing called the scope. As you might have noticed, we defined our people controller with a $scope parameter. We also had to define our people model as a part of this scope. While inspecting the elements, we also noticed multiple ng-scope classes being defined. So, what exactly is this scope and is it really that important?

As per angularjs‘s documents, the scope object refers to the application model and provides an execution context for the expressions in the views.

The expression {{person.name}} is able to display the content only because the name is a property that can be accessed by the scope.

Another important thing to note is that every angularjs app will have a root scope created at the ng-app directive. Many other directives could also create their own scope. Scopes are arranged in a hierarchical fashion following the DOM structure of the page. Child Scopes prototypically inherit from their parent scope.