AngularJS is MVVM framework. Which means Model-View View-Model. A Web Site or Web Application Consists of two modes. One is Client-Side, that is whatever you view on web-browser (Internet Explorer) and Second is Server-Side, i.e. Data or information available on your Web Page like Student Records, Employee Records etc. In case of Client-Side code is run on user device. In case of server side some part of code runs on Server, Which can be, before running on client-side or at any instance, as requested by user.
When you click on a link or open any site, a request goes to Web Server (Source). Server respond to request and sends data back to you device (Destination). Now your device will execute the code send by server and generate view.
To overcome the load on server, we shift some code to execute on client device by using client side framework like AngularJS or any other client-side framework.
Basically AngularJS has main three blocks of code like in MVC. Which are MODEL, VIEW and CONTROLLER apart from them many more like configuration, services, factory, constant, filter, directive, components etc.
VIEW: when you create an HTML page and open this page in any web browser, the contents displayed by browser after render HTML Code, Which is called View.
MODEL: Model can be Individual Variables and Collection Under one common root that is $scope. With the help of $scope we can access any of them at any time, at anywhere like in view and controller.
Controller: View have Model in the form of variables and collections. To control such data over the web page dynamically, we can do it with the help of controller like some calculation, visibility, colors, sending data to server and getting data back from server and many more.
when you use Angular Directive ng-model with HTML Controls. It creates a MODEL. for example:
<input type="text" name="Country" ng-model="country" />
It will create an input box to get Country from user. The Value of Country then stored in $scope.country.
you can access Model Value on View just by typing Model Name surrounding by curly braces. Which is the Syntax of AngularJS to access Model Value in view.
(Place within HTML Code)
You can get Model Value in Controller just by calling Model Name followed by $scope.
var c = $scope.country;
AngularJS framework makes very easy to manage and control data flow from view to controller and controller to server and vice-versa.
If you have any query or question or topic on which, we might have to write an article for your interest or any kind of suggestion regarding this post, Just feel free to write us, by hit add comment button below or contact via Contact Us form.
Your feedback and suggestions will be highly appreciated. Also try to leave comments from your valid verified email account, so that we can respond you quickly.