Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is AngularJS really MVC?

I'm looking through examples on the AngularJS home page — specifically “Add Some Control”. I don’t quite understand how it maps to MVC pattern.

It’s more or less clear that the template (index.html) can be thought of as the view, objects constructed by TodoCtrl from todo.js as the controller, but where is a model? Attributes like ng-model map to some internal pieces of the framework and don’t directly expose an object which we could call a model.

Is it correct to call AngularJS an MVC framework?

like image 928
Paul Lysak Avatar asked Nov 06 '12 09:11

Paul Lysak


People also ask

Is Angular still MVC?

Angular applications still follow an MVC style (or perhaps more correctly MVVM). In fact, they do so more explicitly than ASP.NET MVC applications do.

What is difference between MVC and AngularJS?

AngularJs is a Javascript framework and language used to express programs/functionality is javascript. And . NET MVC (ASP.NET MVC) is a Web development framework based on top of . NET Framework and the language used to express programs/functionality is C# or VB.

Does AngularJS follow MVC architecture?

The only difference is that Angular is now based on TypeScript, which is a superset of JavaScript, but it still maintains the MVC architecture.

Is Angular based on MVC or MVVM?

Angular framework is embedded with original MVC but it's more of an MVVM software architectural setup. Angular does not ask developers to split an application into different MVC components and build a code that could unite them.


1 Answers

The core idea behind MVC is that you have clear separation in your code between managing its data (model), the application logic (controller), and presenting the data to the user (view). The view gets data from the model to display to the user. When a user interacts with the application by clicking or typing, the controller responds by changing data in the model. Finally, the model notifies the view that a change has occurred so that it can update what it displays. In Angular applications, the view is the Document Object Model (DOM), the controllers are JavaScript classes, and the model data is stored in object properties.

like image 125
Reza Avatar answered Sep 23 '22 00:09

Reza