Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

benefit of using angular js on top of asp.net mvc

Is there much point to using angular js on top of asp.net mvc since they're kind of both doing the same thing? What are the advantages to using angular over asp.net mvc + jquery? What kind of scenario would you pick angular in? If you do pick angular in a microsoft environment, what would you run on the server side? Would it be something like Web API? Or is there still benefit of using traditional asp.net mvc?

like image 762
Riz Avatar asked May 04 '13 18:05

Riz


People also ask

Why we use Angular in ASP.NET MVC?

NET developers prefer Angular because it comes with TypeScript and it's a much closer language to C# than plain JavaScript. Angular is an excellent framework for building enterprise-level, feature rich, applications.

Which one is better Angular or ASP.NET MVC?

Both ASP.NET MVC and AngularJS has their own purposes and advantages. As with your specific question, AngularJs is better for SPA (Single Page Applications), where as ASP.NET MVC is a full fledged server side Application which can contain WebAPIs, Routing engine as well as HTML emitting Views.

Can AngularJS used with ASP NET?

Using AngularJS in ASP.NETAfter selecting Web, select ASP.NET Web Application (. NET Framework) under The Web. We need to give the project name in name column, which looks, as shown below. Project template Window will open after clicking OK button.


2 Answers

This question is a bit subjective, however here was our reasoning.

  1. Let the client handle rendering of pages, free up resources on the server.
  2. Leverage built in caching of cache servers since we are just dealing with <html/> content.
  3. Since the pages are cached the only traffic back and forth is json payloads.
  4. We have been using NancyFx, but WebAPI or Service Stack would work just fine.
  5. We wanted to build a responsive single page application and AngularJs fit the bill for testability as full feature rich framework.
  6. AngularJs forces you into a pattern that we needed for JavaScript, in the past our jQuery heavy applications turned into functional spaghetti (That was our fault but being guided by Angular helped out a lot).

As with all frameworks pick the one that suites your needs

like image 92
Mark Coleman Avatar answered Sep 18 '22 22:09

Mark Coleman


On my site http://www.reviewstoshare.com, I am using AngularJS along with ASP.NET MVC. The main reason I did not go all the way with AngularJS was that SEO is not easily achieved with AngularJS. Keep in mind that my site was already built using ASP.MVC + Jquery for in page interaction as needed.

On the other hand there is still some "Ajaxy" nature to the site like comments, voting, flagging etc. Not too different than Stackoverflow itself. Before AngularJS it was a mess of Jquery plugins and functions within $(document).ready() callback, not to mention the JS code was not testable much.

In the end, I went with both.

like image 44
Ketan Avatar answered Sep 19 '22 22:09

Ketan