I have a large AngularJs application and am struggling with route injection/organization.
Most applications ( from what I've seen ) define all the routes in one big file like https://github.com/IgorMinar/foodme/blob/master/app/js/app.js#L7
My routes are rather complex, for example:
app.config(["$routeProvider", function ($routeProvider) {
$routeProvider.when('/navigation/:id', {
templateUrl: 'app/admin/nav/navigation.tpl.html',
controller: 'NavigationCtrl',
title: 'Navigation Config',
resolve: {
nav: function($route, NavModel) {
return NavModel.findOne($route.current.params.id);
},
reports: function($route, ReportsModel) {
return ReportsModel.findAll($route.current.params.id);
}
}
});
}]);
since they are complex and pretty coupled to the controller, my route definition page would be HUGE and very confusing.
Is there a better way to declare the routes? Can you just declare a short version and then extend on it later when that controller is injected?