Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to convert my existing ASP.NET website to a spa website for most of its part. So I am evaluating Angularjs for this project. I have read numerous articles and post describing the use of AngularJS with ASP.NET Web Api but none where it is used in combination with ASP.NET MVC.

So I am wondering is only the landing page going to be servered by ASP.NET MVC and then the rest is handled through AngularJS? Also when setting the routes of the AngularJS app, they surely need to return some views. Are these views going to be returned from ASP.NET MVC actions or they need to be only AngularJS templates which are going to be fetched from the server. If they are Angularjs templates, which seems to be the right choice, then how is the data in these templates going to be boostrapped? I can surely hack my way around all this but some examples or best practices will be much appreciated.

share|improve this question
1  
From a technical stand-point there is nothing against it, so this is primary opinion based. –  ChrFin Dec 1 '14 at 9:31
1  
This is highly subjective. It depends on way to many factors to get an accurate reading. We have "ported" a relatively large project to AngularJS and it has brought mixed feelings among the team members. I would suggest you try to convert small (and successive) parts to see the benefits and impediments it brings. –  Andrei V Dec 1 '14 at 9:33
    
I'm struggling with same question having just recently purchased Freeman's book on Angular. The largest missing link in MVC is full blown client side binding. I see Angular and Knockout filling that gap. Being a C# person, I also absolutely refuse to give up LINQ and EF (missing on client side). The other thing that concerns me in Angular is the fact all the code is visible to client unless obsfucated. But that never bothered Google. For me MVC is my choice for now, but... I am perusing the goodness of Angular the main reason is that by embracing JS librs. the world is much larger. –  John Peters Dec 1 '14 at 9:51
    
I have been researching this and this time in the right direction due to Omar's answer. How to use AngulaJS with ASP.NET is not subjective. There is a best practice here. So please unblock the question, which if you have not noticed I have rephrased, because I would like to answer it. –  Milen Kovachev Dec 2 '14 at 9:36

2 Answers 2

up vote 5 down vote accepted

Mvc with angularjs can fit good when you plan to do something called "mini Spa" application where you have mvc pages serves the main pages for multisections application and after serving the main page from mvc the rest will be handled by angularjs to avoid having a single big spa application. Pluralsight.com has some decent courses about "mini spa" and mvc with angularjs. Hope that helps.

share|improve this answer
    
I was not familiar with the term mini spa but this is exactly what I was looking for! Thanks for the answer. –  Milen Kovachev Dec 1 '14 at 10:11

Like other users commented this will be a matter of debate. Technically nothing is stoping you from using ASP .NET MVC as the backend for your AngularJS frontend. You will simply define your routes which will probably end up simply returning JSON instead of MVC Views.

On the other hand one could argue that this perfectly fits the usecase of ASP .NET WebAPI. I remember I've seen at least in one book the author suggesting the use of WebAPI for building SPA applications (I think it was Pro ASP .NET MVC 5 if I'm not mistaken).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.