In detail.js
(function (module) {
function DetailController($scope) {
//long codes
}
module.controller('DetailController', DetailController);
})(angular.module('app.main'));
In main.js
(function() {
var module = angular.module('app.main', []);
function config($stateProvider) {
$stateProvider.state('app.main.detail', {
url: 'detail',
views: {
'detail@': {
templateUrl: 'app/main/detail.html',
controller: 'DetailController as vm'
}
}
})
}
module.config(config);
})();
How can I split detail.js controller into subcontroller? because I have more than 1000 lines of code. Thank you