AngularJS MVC Architecture – Learn How MVC Works in AngularJS?

Since we had studied, AngularJS Modules. Today, we will talk about AngularJS MVC. MVC stands for Model View Controller, it is a software design pattern for designing and developing a web application. Here, we will learn MVC architecture & components and How MVC works in Angular JS.

So, are you ready to explore the Angular Model View Controller (MVC)?

AngularJS MVC Architecture - How MVC Works in AngularJS?

AngularJS MVC Architecture – How MVC Works in AngularJS?

1. What is AngularJS MVC?

MVC is nothing but the software design pattern for designing and developing a web application. It is considered as the architectural pattern that has existed for a long time in software engineering. Many languages use MVC architecture with little variations in each one of them but conceptually it remains the same.

In angular, we organize things in some different manner as compare to regular javascript. Therefore, Model View Controller architecture is the most popular and latest way of organizing an application.

Do you know What are Directives in AngularJS?

2. AngularJs MVC Architecture & Components

AngularJS MVC divides an application into three parts- Model part, View Part, Controller Part. Let’s see for what purpose each component of MVC serves:


Model part consists of a database (use to store data), application data (application data are variables that are specific to a user. Application and logic (Logic refers to code that is written to perform a certain task).


View part is the user interface part of an application. The information that is being displayed to the user in an application is written in this part.


The interaction between the model part and view part is controlled by a controller. It is more like software code.

AngularJS MVC Architecture and Components

AngularJS MVC – Architecture & Components

3. How MVC Works in AngularJS?

We can implement MVC pattern through JavaScript and HTML. HTML helps to implement model part, while JavaScript is for model and controller part.

Recommended reading – Data Binding in AngularJS

When a user enters a URL in the browser, according to that specific URL control goes to the server and calls the controller. After that controller uses the appropriate model and appropriate view so that appropriate response can be made for user’s request. It creates the response and that response is sent back to the user.

Working of AngularJS MVC

How MVC Works in AngularJS?

4. MVC In AngularJS

Here, we will see how the components of MVC works in AngularJS:

i. Model Part In Angular Application

It responds to the request made from view part. It can obtain data dynamically means you can get data from database like from MySQL or you can get data from static JSON (JavaScript Object Notation) file.

    $scope.person =  { 
                          'Name'      :   'Ram Kumar ', 
                             'Address'  :   'AB Road, Katni', 

 AngularJS MVC

AngularJS MVC – Working of Model, View & Controller

ii. View Part In Angular Application

It is the presentation part of an application. Through the view part, a user can see the Model part. Therefore, the model and view part join together.

<h1> {{}} </h1>

Also, read – ngmodel in AngularJS

iii. Controller Part In Angular Application

It is the central part of the angular application. Everything starts with a controller in angular. The model part and the view part join with each other. It means whatever happen to the model part automatically effects to the view part and whatever happens to the view part automatically effects to the model part also. Controller joins the model and view part.

function address($scope)
// Model Part is written here

Look at this final code with a model part, view part and controller part in the single code

<!doctype html>
<html ng-app>
            <title>Angular MVC </title>
            <script src=”lib/Angular/angular.min.js”></script>
            <div ng-controller = “address”>
                     <h1>{ {Person.Name} }</h1>
            <script type=”text/javascript”>
            function address($scope){
                 $scope.Person= {
                          'Name'      :   'Ram Kumar ', 
                             'Address'  :   'AB Road, Katni', 


Ram Kumar

Have a look – Features of AngularJS

5. Conclusion

This is how MVC architecture works in angular. The various aspects of an application divided into three components (Model, View and Controller) to separate responsibilities. A model contains application data, a view contains the visual layout and a controller connects the view part and model part. Furthermore, if you have any query, feel free to ask in the comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.