It took me a while to figure out how to get angularjs to work with asp.net mvc - it's not 100% the way you did something, but you can rethink this approach (it is not that much different anyway)
var AccountApp = angular.module("AccountApp", ['$strap.directives', 'ngResource', 'ngGrid', 'filePickers']). config(function ($routeProvider) { $routeProvider. when('/', { controller: ListCtrl, templateUrl: 'Templates/Account/List' }). when('/', { controller: EditCtrl, templateUrl: 'Templates/Account/Edit' }). otherwise({ redirectTo: '/' }); });
Ok, notice that I call Templates / Account / List.
In my RouteConfig.cs
routes.MapRoute( name: "Templates", url: "Templates/{controller}/{template}", defaults: new { action = "Template" } );
Now, in each controller, I have a corresponding action that directs the call to the corresponding partial view:
public ActionResult Template(string template) { switch (template.ToLower()) { case "list": return PartialView("~/Views/Account/Partials/List.cshtml"); case "create": return PartialView("~/Views/Account/Partials/Create.cshtml"); case "edit": return PartialView("~/Views/Account/Partials/Edit.cshtml"); case "detail": return PartialView("~/Views/Account/Partials/Detail.cshtml"); default: throw new Exception("template not known"); } }
It all starts with the action of Index () in the controller.
public ActionResult Index() { return View(); }
Putting it all together, my directory structure looks like this.
/Views /Account /Partials List.cshtml Create.cshtml Edit.cshtml Detail.cshtml Index.cshtml
I am biased as this is my approach, but I think it makes things very simple and organized. Index.cshtml contains ng-view, and all other parts of the application are well contained in partial views loaded through this Template action. Hope this helps.