I really think these two frameworks don’t mesh together too well and this blog post is me trying to explain why.
I’d suggest using WebApi instead. This is what I’ve found out works best.
- The server side actions on the ApiController should only return JSON data to the client and be consumed by ajax calls from angular.
- Stop thinking in terms of razor and writing C# code in your views and working with the @model passed from the controller.
- Only have one razor page for your app (Index.cshtml), no views, no partials. Load everything on the index page.
- Do not use the MVC routing, let angular perform the dynamic page updates.