What is inherited/child Scope in Controller?

0 votes
Explain with example how any sub-controller have its one scope which is inherited from its parent?
Feb 5 in Angular by kartik
• 10,760 points
20 views

1 answer to this question.

0 votes

hii,

As you know(if not refer  ) that scope is a special memory allocation when the controller is initiated.

But inherited Scope is the addition memory allocation of a controller which is defined under its parent controller. It is completely opposite to shared scope where the parent and child have same scope.

Let us understand by the following example:

<body ng-app="sample> 

          <div ng-controller="emp">

                  name={{name}}

                  <div ng-controller="emp-details">

                          id={{id}}

                     </div>

           </div>

</body>

Here "emp" is a parent contoller having its own scope containing its on data to it i.e name . There is another controller named emp-details which is also having its own scope but having its own data i.e id it also have access to parent scope data i.e name.

{note}- 1.If there is any change in parent scope those are reflected in child scope but the vice-versa is not true.                             

        2.If you want to that changes get reflected from child scope to parent you can have exclusive method by using $parent.data_item=new_val;

answered Feb 5 by Niroj
• 21,680 points

Related Questions In Angular

0 votes
1 answer

What is shared scope(in Directive)?

Assuming that you have knowledge on Scope( ...READ MORE

answered Feb 4 in Angular by Niroj
• 21,680 points
29 views
0 votes
1 answer

What is Scope Parameter in AngularJS?

Hey @kartik, Scope Parameter is a collection of ...READ MORE

answered Feb 5 in Angular by Niroj
• 21,680 points
50 views
0 votes
1 answer

What is isolated Scope in AngularJs?

Hello kartik, As we know Scope is a ...READ MORE

answered Feb 5 in Angular by Niroj
• 21,680 points
30 views
0 votes
1 answer

What is transclusion Scope in AngularJs?

hey @kartik, Let me start with What is ...READ MORE

answered Feb 6 in Angular by Niroj
• 21,680 points
17 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 67 views
+1 vote
1 answer

What is css box module?

Hey, All the element present in html follows ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 53 views
0 votes
1 answer

Explain the difference between visibility:hidden; and display:none?

hii, visibility:hidden; and display:none are totally different used ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,680 points
349 views
+1 vote
1 answer

How to access the Angularjs scope of a particular html element from our console?

Hello, You should follow the below steps:-- 1.Compile and ...READ MORE

answered Jan 21 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 52 views
0 votes
1 answer

What is inherited/child scope in directive?

Hey kartik, As you use the term inheritance ...READ MORE

answered Feb 5 in Angular by Niroj
• 21,680 points
28 views
0 votes
1 answer