Angular JS supports MVC style of application design. MVC means Model-View-Controller. Lets understands each of this in Angular JS.
Controller
Controller responsibility is to wire up the $scope (which holds your models) to your view. Angular Model lives inside a controller, you use $scope inside a controller as a glue between controller and view.
Controller contains business logic behind the application to decorate the scope with functions and values.
Example : controller creation
Model
A model in angular can be a primitive type such as string, number, boolean or a complex type such as object. In short model is just a plain javascript object.
Model lives inside a controller.
Scope is an object and models are the properties of a scope
Example : model creation
Here name is model of type string and name is the property of $scope object.
View
View is what the users see, in angular view is HTML
Example : view creation
Lets combine all components that is Model-View-Controller
model contains your data and with the help of $scope in controller, your model data will be available to your view
Link of Model-View-Controller example
Resource
http://mrbool.com/mvc-in-angularjs/28962
Controller
Controller responsibility is to wire up the $scope (which holds your models) to your view. Angular Model lives inside a controller, you use $scope inside a controller as a glue between controller and view.
Controller contains business logic behind the application to decorate the scope with functions and values.
Example : controller creation
Model
A model in angular can be a primitive type such as string, number, boolean or a complex type such as object. In short model is just a plain javascript object.
Model lives inside a controller.
Scope is an object and models are the properties of a scope
Example : model creation
Here name is model of type string and name is the property of $scope object.
View
View is what the users see, in angular view is HTML
Example : view creation
Lets combine all components that is Model-View-Controller
model contains your data and with the help of $scope in controller, your model data will be available to your view
Link of Model-View-Controller example
Resource
http://mrbool.com/mvc-in-angularjs/28962
Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.We are providing AngularJs training in velachery.
ReplyDeleteFor more details: AngularJs training in velachery
This comment has been removed by a blog administrator.
ReplyDelete