This blog is in continuation with my previous blog on AngularJs, In this blog i am going to discuss about the most popular concept (MVC) on the basis of which an AngularJs application is developed.
MVC stands for Model View Controller used in most of the programming languages other than AngularJs like in Asp.net,JAVA etc.
MVC is used while developing any web application as it helps a programmer to create a program architecture as per their requirements.
Using MVC concept one can design and develop a properly architectured, easily maintainable client-sided web-application .
MVC plays an important role behind making AngularJS one of the most popular scripting language.
MVC is composed for three words each of them have different meaning and importance.All three are totally dependent and synchronized with each other.
View's responsibility is to render the application data recieved by the Model so it has nothing to do with the logic behind the application data created and the Controller's responsibility is to create all the logics to create an application data and send it to the Model so it has nothing to do with the views that's why it has no knowledge about the views. In between them Model plays an important role of transferring data using $scope from views to controller and vice-versa. Data recieve by controllers is on client-side, all the data collected by controller is send to the back-end servers.
M-MODEL : Model is the last level for design pattern we create while developing web applications but it is the most important part of the architecture as it is the mediator between view and controller helps in transferring data and responding to both of them with updated and maintained application data.
Here is an example in which i have created an AngularJs datamodel to stored application data.
V-View : Use of view is same as the meaning of it.View is nothing but the area where output of the web application data is displayed in different ways.
Any Browsers can be considered as the view of MVC framework because this is the place where output is rendered and allow users to interact or see the application data.
To display the web application data we can either use ng-bind i.e an AngularJs directive or an AngularJs expression.
Here is an example in which i have displayed the web application data using both the ways i.e an AngularJs directive and an AngularJs expression.
C-Controller : Controller is the one who creates all the logics, collects and controls all the datas used to create an application in AngularJS and send them to the data model after validating it so that it can be rendered at the View.In MVC framework controller has the responsibility of communicating with the server code and fetch data from a server and vice-versa using Ajax requests.
Here is an example in which i have created an AngularJs Controllers to stored application data.