What is the difference between MVC in Angular JS and MVC in ASP.NET or Spring MVC?

I am trying to understand the architecture of modern web applications. In ASP.NET MVC, all business logic classes in Model and Controller accept and route user requests. If I use it, is it possible to use Angular JS, which itself is an MVC architecture, but all business logic is in the controller and the model is just a POJO. Can Angular JS only be used with Web API 2 where it gets data from a RESTful service and does all the manipulation on the client side? What is the most commonly used architecture?

+3


source to share


3 answers


In ASP.NET MVC, all business logic classes are in Model and Controller accept and route custom requests

This is not true. Models (aka ViewModels) must be transparent ("POCO") data containers in ASP.NET MVC. The business logic should come from the layer consumed by the controllers, but in small applications or before refactoring, the controller is a better choice than the Model (View).

Can Angular JS only be used with Web API 2 where it gets data from a RESTful service and does all the manipulation on the client side? What is the most commonly used architecture?



No, you can use ASP.NET MVC with Angular JS as well by returning JsonResults from controller actions. However, WebAPI is a better / more appropriate choice. Of course, you can also use Angular with many other non-Microsoft tools that return JSON via http (s) (e.g. node, ruby, java, etc.).

To answer your real question more accurately, the main difference between the two is that one is Server MVC and the other is Browser MVC. Angular really likes to call it the MVW pattern, where the "W" stands for "Whatever."

+1


source


From my point of view, you are mixing two very different technologies; One of them is server side (ASP.NET MVC), one of which is client side (AngularJS).

These two can certainly be used hand in hand as they are independent of the other existing. And, IIRC, NuGet has a scaffolding module that helps bind to each other (create JS objects from ASP.NET POCO objects).



With that said, there is no reason why you need to use both. Can you use one or the other, both, or use a different technology altogether (KnockoutJS, etc.)?

+1


source


Like other design patterns (Singleton, Factory, Factory) MVC is also a design pattern that we can use in any technology, for example (Java, .net, PHP) or on any client site script. there is no difference between MVC in Angular JS and MVC in ASP.NET and Spring MVc

+1


source







All Articles