What is shared scope in Directive

0 votes
Can anyone help me out with this tricky word name shared with scope(shared scope) with an example?
Feb 4, 2020 in Angular by anonymous
• 37,510 points
935 views

1 answer to this question.

0 votes

Assuming that you have knowledge on Scope( If not refer-Scope).

Taking you to the term called Shared Scope let's imagine i'm having markup related to Angularjs and that markup as you can see it has got a controller attached to that named as " sample" and that controller has couple of bindings here like a={{a}} and b={{b}} to be displayed from the scope which means this particular controller has some scope attached to it and imagine that particular scope is having member a=10 and b=20 those value are automatically to be displayed in a={{a}} and b={{b}}.

Now let us consider we are including a directive which is named as message and this message directive is to be instantiate by providing at the element level and takes mark-up from templateurl  and replace in element level.

if we have directive based element to be used inside controller element so,now which scope it will access??
By default it will access the scope which is define at the parent-level or controller level. so message element share the controller scope which is already defined by parent controller. This is called shared Scope.

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

Related Questions In Angular

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is inherited/child Scope in Controller?

hii, As you know(if not refer  ) that scope ...READ MORE

answered Feb 5, 2020 in Angular by Niroj
• 82,880 points
419 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,880 points
729 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 780 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 955 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,910 points
118,352 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,444 views
0 votes
1 answer
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,880 points
938 views
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