I'm currently working on a project using UI Router. My code currently defines states as part of the app config ( example below ) but the code is growing. Is there a good way to modularize this code both for organization and unit testing? For me the best solution would be to define states as an external service.
.state('page', {
url: '/page/{id}',
params: {
id: ['$q', function ($q) {
// Code
return defaultValue;
}],
},
templateUrl: 'page.html',
'controller': 'CatalogDetailsController',
'controllerAs': 'details',
resolve: {
categories: ['$q', function ($q) {
// Code
return promise;
}],
},