in Angular by
Can you explain the concept of scope hierarchy in Angular?

2 Answers

0 votes
by
Angular organizes the $scope objects into a hierarchy that is typically used by views. This is known as the scope hierarchy in Angular. It has a root scope that can further contain one or several scopes called child scopes.

In a scope hierarchy, each view has its own $scope. Hence, the variables set by a view’s view controller will remain hidden to other view controllers. Following is a typical representation of a Scope Hierarchy:

Root $scope

$scope for Controller 1

$scope for Controller 2



..

.

$scope for Controller n
0 votes
by

Angular provides the $scope objects into a hierarchy that is typically used by views. This is called the scope hierarchy in Angular. It has a root scope that can further contain one or several scopes called child scopes.

In a scope hierarchy, each view has its own $scope. Hence, the variables set by a view's view controller will remain hidden to other view controllers.

Following is the typical representation of a Scope Hierarchy:

  1. Root $scope  
  2. $scope for Controller 1  
  3. $scope for Controller 2  
  4. ...  
  5. ..  
  6. .  
  7. $scope for Controller n  

Related questions

0 votes
asked Dec 13, 2020 in Angular by SakshiSharma
0 votes
asked Feb 15, 2020 in Angular by matthenary
+1 vote
asked Jan 15, 2020 in Angular by rahuljain1
...