What is the relation between transclusion scope and directive isolated scope in AngularJS

0 votes
Can anyone explain me what is the relation of inheritance  that is depicted in directive isolation scope with transclusion scope?
Feb 6, 2020 in Angular by anonymous
• 37,520 points
678 views

1 answer to this question.

0 votes

hey,

Let me help you out with the following piece of code assuming that we have a final code after being transclusion:

(If you want to know how this  sample final code is achieved you can first check it out the link- Transclusion)

 <div ng-controller='emp'>
           Some  message from controller
                <div message>
                             This is from msg template
                             <div>This is inner message</div>                               
                </div>
  </div>

From above it is clear that there is only one controller named emp and directive named message in it which has a transclude text embed in it.

So, first the parent scope i.e controller scope is made available through the entire cycle and then we have directive scope which is named as directive isolated scope because the directive scope is independent from its parent scope. so, all the data available in controller scope is not available to directive scope and parent's data member is not available in directive scope untill we use $parent here which is used to access the data member of parent's scope i.e the controller scope

Now, we were having a transclusion scope which is having new instance independent of its parent scope and this particular instance is inherited from its parent scope . As it inherit the controller scope, so all data member is available in the transclusion scope and another special things to be remember when an new instance of transclusion is created there is always $parent member is associated with the transclusion scope along with parent's data member. In this case $parent is going to refer the directive scope  but not to the controller scope. This $parent is used to access the data member of the directive scope as well as controller scope.

The whole scenario from the above explanation can be depict from the diagram attached below.

answered Feb 6, 2020 by Niroj
• 82,880 points

Related Questions In Angular

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,880 points
737 views
0 votes
1 answer

What is the difference between Call back transclusion function and no call back transclusion function?

Hey,    There is no difference between clone linking and ...READ MORE

answered Feb 5, 2020 in Angular by Niroj
• 82,880 points
629 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,880 points
814 views
0 votes
1 answer

What is the service that is used to configure the UI-Router and ngRoute in AngularJs?

Routing comes into play whenever you want ...READ MORE

answered Feb 11, 2020 in Angular by anonymous
• 82,880 points
537 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,880 points

edited Jan 21, 2020 by Niroj 1,099 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,880 points

edited Jan 21, 2020 by Niroj 1,178 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,890 points
119,600 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,880 points

edited Jan 21, 2020 by Niroj 2,906 views
0 votes
1 answer
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