AngularJS is more connected with the paradigm of a one-page application and, as such, does not really benefit from server technologies that do markup. There is no technical reason that prevents you from using them together, but in a practical sense, why are you?
SPA extracts the resources it needs (JS, CSS, and HTML) and launches on its own, exchanging data with services to send or receive data. Thus, server technology is still necessary to provide these services (as well as other means, such as authentication, etc.), but the parts of the rendering are largely irrelevant and not particularly useful, since duplication of efforts, with the exception of MVC, is on server side and Angular does this on the client. If you are using Angular, you want to get it on the client for best results. You can make Angular submit HTML forms and get partial views from MVC actions, but you cannot use the best and easiest Angular functions and make your life more difficult.
MVC is quite flexible, and you can use it to service calls from a SPA application. However, the WebAPI is more precisely configured and a little easier to use for such services.
I wrote several AngularJS applications, including a couple that was ported from pre-existing WebForms and MVC applications, and the ASP.NET aspect is developing towards a platform for delivering an AngularJS application as an actual client and for hosting the level of the application that the client communicates with through REST (using WebAPI). MVC is a great structure, but it usually fails to work in such applications.
An ASP.NET application becomes another layer of infrastructure where its responsibilities are limited:
- Installs the dependency container.
- Plug the implementation of business logic into a container.
- Customize asset packages for JS and CSS.
- WebAPI host services.
- Secure, log and diagnose.
- Interaction with application caches for performance.
Another great thing about SPA is increasing the bandwidth of your team. One group can disable services, and the other in the client application. Since you can easily drown out or mock REST services, you can have a fully working client application for mock services and change it to real ones when they are executed.
You need to invest forward on Angular, but it pays off. Since you are already familiar with MVC, you have an advantage over some of the basic concepts.
HackedByChinese Jan 13 '14 at 18:00 2014-01-13 18:00
source share