bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

MVC in AngularJS

 

MVC stands for Model View Controller.   It is a software design pattern which is used to developing web applications. It gives developers a starting point in deciding how and where to divide responsibilities.  It splits the application into three parts:-

mvc

 

1. Model: Represents current state of your application. Generally, this is the data behind the application, typically fetched from the server.

e.g.

var msg = 'Hello Intellipaat';

2. View: It displays all or a portion of the data to the user. To display the data from controller you can put angular expression in your view. This expression joins data from model inside your controller.

e.g.

<p>{{msg}}</p>

3. Controller: Controls the relation between Models and Views. It is the business logicwhich performs actions such as fetching data and makes decisions such as how to present the model, which parts of it to display etc.

e.g.

function TextController($scope) {

$scope.msg = msg;

}

Combine model view controller in one application like as follows:

<html ng-app>

<body ng-controller="TextController">

<p>{{msg}}</p>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js">

</script>

<script>

function TextController($scope) {

$scope.msg = 'Hello Intellipaat';

}

</script>

</body>

</html>

Output

Hello Intellipaat

So, the model is the data, the view is the User Interface and the controller is the business logic.

"0 Responses on MVC in AngularJS"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 09th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free MVC in AngularJS.