Search This Blog

Translate

What is view controllers and scope in angularjs

View Controllers And Scope

View contorller and scope
View Controllers And Scope
Today we learn about views, controllers and scope in angularjs. If you don't know about directive, data binding, filters in angularjs you will must read this tutorial, then you will learn this tutorial otherwise you will can't understand this tutorial. Now lets start first we will discuses about view. We are use view when we will be work on a professional way with angularjs, in previous tutorial you learn Directive, Data Bind, Filter this is called also view But we don’t want to put all of our logic into the View because it’s not very maintainable or testable or all those types of things.

Now We Create A View

First you will make a one div and make a view and give a controller name within div tag data-ng-controller then show the list with data-ng-repeat directive

View contorller and scope
View contorller and scope

No We Create A Controller

You will make a one function and pass a $scope parameter then you will make a one Array and join the $scope parammter and then you will make a objects within array. Now your controller is ready.

View contorller and scope
View contorller and scope

Full Example

Now you will see the full example and understand.



View contorller and scope
View contorller and scope

Check Now Example In Your Browser

Now you will see the full source code. You will copy the all code and paste in you favorite text editor like Sublime Text 3 and save it the name of file is angularExampe.html. Now you will see the result



Out Put

View contorller and scope
Out put
I hope this tutorial was very help full for you and easy to understand. If you like this tutorial please give me your feedback and share it every one.