I'm using UI-router's $stateProvider
for the routing on an angularjs project and find myself repeating a lot of the same configuration for the route views.
For example:
$stateProvider.state('triage', {
url: '/operations/triage',
views: {
"header": {
controller: 'CommonCtrl',
templateUrl: 'common/header.tpl.html'
},
"submenu": {
controller: 'CommonCtrl',
templateUrl: 'common/submenu.tpl.html'
},
"content": {
controller: 'TriageCtrl',
templateUrl: 'operations/triage/triage.tpl.html'
},
"footer": {
templateUrl: 'common/footer.tpl.html'
}
},
The header
, submenu
and footer
will be the same for almost every state, the content
is really the only part that is variable.
Is there a way to configure the router to always use predefined controllers and templates unless otherwise specified.