What is transclusion Scope in AngularJs

0 votes
Is there any difference between scope of controller and directive scope? can anyone help me out explaining about transclusion Scope?
Feb 6, 2020 in Angular by kartik
• 37,520 points
840 views

1 answer to this question.

0 votes

hey @kartik,

Let me start with What is scope?

A scope is an memory area or any logical area for storing data's or functions which is created when any controller, directive or Transclusion is instantiated.

So, There is no difference between Controller scope, Directive scope and Transclusion scope as each one having scope related to it but they differ only in inheritance and shared scope between them.
Now, let me take you to the senario i.e what  is transclusion scope?

Let us consider the following piece of code:

<body ng-app="app">

         <div ng-controller='emp'>

               Some message from controller

                   <div message>
                             This is from template msg
                              <div>This is inner message</div>                                                   

                    </div>
           </div>

</body>

From Above code it can be seen that there is a controller named emp, one directive named message and one transclusion inside the directive block.

So, when  controller block in executed there is assign a special scope called controller scope and then control transfer to directive block and then another scope block is created. After creating directive scope, transclusion scope is created at the end where it can access all the data available in controller scope as well as directive scope.

For more clear to the topic here is the flow image:

Hope this helps you to understand about Transclusion Scope.

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

Related Questions In Angular

0 votes
1 answer
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,046 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
768 views
0 votes
1 answer

What is transclusion in AngularJS?

Hey, Let me explain you about transclusion from ...READ MORE

answered Feb 5, 2020 in Angular by Niroj
• 82,840 points

edited Feb 5, 2020 by Niroj 859 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,144 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,206 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,702 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,971 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