I currently have an AngularJS app with routing built in and it works perfectly with static controller
property assignments. but what I really want to do is to dynamically assign controllers with different routes:
$routeProvider
.when("/Dashboards/:dashboardName",{
templateUrl:function(params) {
return "Dashboards/" + params.dashboardName;
//some ASP.NET MVC calls to return partial views (this part works)
}
})
What I would like to do is to do the same thing about my controller
property here, like:
$routeProvider
.when("/Dashboards/:dashboardName",{
templateUrl:function(params) {
return "Dashboards/" + params.dashboardName;
//some ASP.NET MVC calls to return partial views (this part works)
},
controller: function(params) {
return params.dashboardName+"Controller"; (this part DOESN'T work)
}
})
but as it seems I am get an error saying paramsProvider
is not found
so is there any way I could dynamically load my controller function name in route configuration?