Let me give a sample code to better explain .Below is the code :
$routeProvider
.when("/b/:param",{
templateUrl:"main.html"
controller:"MainCtrl"
})
.when("/c/:param",{
templateUrl:"main.html"
});
Now from the above code you can see that for one route I have specified the controller that is to be assigned to the view and for the other I didn't add the controller property so for that route there won't be any controller assigned on the page .
Now my question :
When I don't specify the controller property in the route is there any other way that I can assign the controller for that route dynamically?
What I have tried
I have gone through some of the SO pages related to this, one of which is -> dynamically loading the controller in angularjs $routeProvider
Now I have tried some solutions from the post above which didn't work for me .If any from them works please give me more information on how to implement them .
Solutions like setting controller within page or using ui-router are not the type of solutions I am looking for .So please don't give answers like that .
I tried setting controller using some of the functions available through $controllerProvider & $controller , $routeProvider & $route but didn't work out .I am still not sure if using them I can do the task if they do please answer how to use them .
If question still remains unclear please add a comment below this question .Thanks .