Currently getting to know ui-router. I have this:
$stateProvider
.state('taxonomy', {
url: '/lista/:taxonomy',
views: {
'' : {
templateUrl: '/js/app/taxonomy/index.tpl.html',
controller: 'taxonomy.index.controller',
controllerAs: 'vm',
myClass: 'classForThisOne'
},
'sidebarRight@': {
templateUrl: '/js/app/taxonomy/sidebarRight.tpl.html',
/* no controller = no variable */
}
}
})
.state('taxonomy.detail', {
url: '/:mode/:taxonomyId?',
views: {
'sidebarRight@' : {
templateUrl: '/js/app/taxonomy/detail.tpl.html',
controller: 'taxonomy.detail.controller',
controllerAs: 'vm',
myClass: 'myClassForThisController'
},
'': {
myClass: 'myClassForController taxonomy.index.controller'
}
}
});
What I would like to be able to do is to be able of the 'myClass' property inside the controller I specified with the controller and controllerAs variable. Can this be done somehow?
I tried to watch the $stateChangeStart event and $stateProvider.decorator('views', function (state, parent) { }) but without any luck.