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, 2020 in Web Development by kartik
• 37,510 points
800 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, 2020 by Niroj
• 82,880 points

edited Jan 21, 2020 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, 2020 in Web Development by Niraj

edited Jan 21, 2020 by Niroj 3,190 views
0 votes
1 answer

What is the difference between JavaScript and jQuery?

JavaScript is an independent language and can ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,640 points
433 views
0 votes
0 answers

what is the difference between jquery-1.8.2.js and jquery-1.8.2.min.js

i find a topic about difference between ...READ MORE

Aug 19, 2022 in Web Development by gaurav
• 23,260 points
443 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, 2020 in PHP by Niroj
• 82,880 points
2,305 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, 2020 in PHP by Niroj
• 82,880 points
3,445 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, 2020 in PHP by varun
3,466 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, 2020 in Node-js by Niroj
• 82,880 points
4,651 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, 2020 in Web Development by Niroj
• 82,880 points
509 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, 2020 in Web Development by Niroj
• 82,880 points
1,647 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