I have following problem with nested routings... I'm not able to do it.
Used technologies: AngularJS, RequireJS; AngularAMD, Angular Route.
So... first of all I want to show my main routing:
app.config(function($routeProvider, $locationProvider, $translateProvider) {
$routeProvider
.when("/",
angularAMD.route({
templateUrl : "app/src/home/HomeController.html",
controller : "HomeController",
controllerUrl : "app/src/home/HomeController.js"
})
)
.when("/overview",
angularAMD.route({
templateUrl : "app/src/home/HomeController.html",
controller : "HomeController",
controllerUrl : "app/src/home/HomeController.js"
})
);
});
As you can see I'm redirecting the pathes '/' and '/overview/' to 'app/src/home/HomeController.html'.
In HomeController.html I'm loading sub controller and views like this:
...
<div ng-include="'app/src/home/'+currentLocation+'/index.html'">
</div>
...
while currentLocation is the path itself. So / and /overview/ in this case. And in my controller:
define([
"app",
"src/home/overview/index",
],
...
So I'm forced to include my controllers as dependencies before loading the view. So I wanted to know if there's a proper way doing these routes in Angular and RequireJS?
Thanks in advance. :)