What is the relationship between angularjs Scope with controller/view?

+1 vote
Want to know about what happens if ng-controller is defined without any reference of controller and vice-versa.
Jan 20 in Web Development by kartik
• 27,780 points
126 views

1 answer to this question.

0 votes

Let us consider the below block:

<div ng-controller="emp">  //emp is the controller name

.........(View Part)

</div>

When above block is compiled, it tries to create boundary/context which is stored in some browser memory that contains some data in block which is not shown to user.

The boundary/context is then attached to ng-controller="emp" block. So the boundary has the direct accessed by the block.

This boundary/context is called as scope. So when you mention emp you are saying to create new controller instance along with scope being merged. Now,Scope acts as a mediator between controller instance and view(block).

Now,finally if view wants to send data to controller then it send through scope and vice-versa.

Explanation of above is attached for your reference:

Image shows the relationship of scope with controller and view

answered Jan 20 by Niroj
• 59,780 points

edited Jan 21 by Niroj

Related Questions In Web Development

0 votes
1 answer

What is the difference between span and div?

The div should be used to wrap sections of ...READ MORE

answered Jan 16 in Web Development by Niraj

edited Jan 21 by Niroj 638 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
• 59,780 points

edited Jan 21 by Niroj 92 views
0 votes
1 answer

What is data binding in AngularJS?

Data binding is synchronization of data between the ...READ MORE

answered Jan 23 in Web Development by Niroj
• 59,780 points
70 views
0 votes
1 answer

How can we avoid my php form from hacking?

Hii @kartik, If you want to know php ...READ MORE

answered Feb 13 in PHP by Niroj
• 59,780 points
214 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13 in PHP by Niroj
• 59,780 points
249 views
0 votes
1 answer

How to shrink Navigation menu or bar on Scroll?

Hey, You can follow the steps below in ...READ MORE

answered Feb 19 in PHP by varun
1,041 views
0 votes
1 answer

How to reload or re-render the entire page using AngularJS?

Hello @kartik< For the record, to force angular ...READ MORE

answered Jul 15 in Node-js by Niroj
• 59,780 points
42 views
+2 votes
1 answer

What are the different ways of using angularjs scope?

Hey!! basically there the three ways of using ...READ MORE

answered Jan 21 in Web Development by Niroj
• 59,780 points
67 views
+1 vote
9 answers

What is the difference between web design and web development?

A designer designs the web pages and ...READ MORE

answered Jan 22 in Web Development by Niroj
• 59,780 points
183 views