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 in Angular by anonymous
• 1,910 points
16 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 by Niroj
• 3,230 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 in Angular by Niroj
• 3,230 points
13 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
• 3,230 points
22 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
• 3,230 points

edited Jan 21 by Niroj 29 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
• 3,230 points

edited Jan 21 by Niroj 30 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
• 3,230 points
57 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
• 3,230 points

edited Jan 21 by Niroj 31 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 in Angular by Niroj
• 3,230 points
13 views