Search code examples
asp.net-mvcangularjsroutesasp.net-mvc-routingangularjs-routing

angularJS routing in asp.net MVC


I'm newbie in angular so i have two questions on AngularJS routing. Deeply sorry if this has been answered. tried a brief search, didnt find exact match.

  1. I get the idea of SPA, the cost of asp.net server round trip, however, what's a valid real world scenario that make best use of both server side routing and client side routing together? or simply give up the asp.net mvc routing at all?
  2. If partial routing rules defined on both side, isn't it a bit messy?

Solution

  • well, that depends on what you need I saw some people doing a mix of routes between angular and MVC, you can take a look to he boilerplate and hot towel projects for asp.net and angular combo take them as reference, both are like starter kits.

    In my personal opinion (and this is subjective), I prefer to use a RESTFul architecture / SPA let angular do the routing and have web API or service stack as a middleware very much like the mean.js approach for me it's a cleaner and more natural for a SPA application.

    take a look to this article that talks about rest API and some best practices.