I often need more than one controller in a single route and I'd like to know if I can use this kind of syntax:
angular.module('app', ['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/', {
template : 'index.html',
controller : ['Ctrl1', 'Ctrl2']
});
}]);
index controller folder
angular.module('app')
.controller('Ctrl1', function(){
})
.controller('Ctrl2', function(){
});
Controllers can become very large.
The purpose is to load them only when needed.