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, 2020 in Angular by kartik
• 37,520 points
651 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, 2020 by Niroj
• 82,840 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, 2020 in Angular by Niroj
• 82,840 points
1,349 views
0 votes
1 answer

What is Scope Parameter in AngularJS?

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

answered Feb 5, 2020 in Angular by Niroj
• 82,840 points
1,049 views
0 votes
1 answer

What is isolated Scope in AngularJs?

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

answered Feb 5, 2020 in Angular by Niroj
• 82,840 points
775 views
0 votes
1 answer

What is transclusion Scope in AngularJs?

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

answered Feb 6, 2020 in Angular by Niroj
• 82,840 points
847 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, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 1,153 views
+1 vote
1 answer

What is css box module?

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

answered Jan 20, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 1,211 views
0 votes
3 answers

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

display:none means that the tag in question will ...READ MORE

answered Dec 14, 2020 in Web Development by Gitika
• 65,770 points
119,715 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, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 2,983 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, 2020 in Angular by Niroj
• 82,840 points
1,254 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP