I have the following states defined for ui-router:
var questions = {
name: 'questions',
url: '/questions',
views: {
'menu': {
templateUrl: '/Content/app/questions/partials/menu.html',
},
'content': {
templateUrl: '/Content/app/common/partials/empty.html',
},
'status@': {
templateUrl: '/Content/app/questions/partials/status.html',
}
}
}
var questionsContent = {
name: 'questions.content',
parent: 'questions',
url: '/:content',
views: {
'content@': {
templateUrl: function (stateParams) {
var isNumber = !isNaN(parseFloat(stateParams.content));
return isNumber ? '/Content/app/questions/partials/detail.html' :
'/Content/app/questions/partials/content.html'
},
},
}
}
I would like to define just the one controller for this.
I've seen examples like this that do it for each view:
'content@': {
templateUrl: '/Content/app/home/partials/content.html',
controller: 'HomeContentController',
}
Is it possible for me to have one single controller that is used for all of the views and to do that would I need to specify the controller each time for each view.
Also when the /:content value changes how can I detect the change of state in my controller and then do something?