This is my plunker http://plnkr.co/edit/GMfMcXgHguYjFYoxWEaM
1.) click the above live demo link
2.) click the "create" button which should activate the projects.create state
3.) an alert() should pop up now but it does not.
Why are those onExit and onEnter callbacks in the projects state definition not called?
The projects state onExit should be triggered when this state is left and we activate the projects.create state.
app.js
.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/projects');
$stateProvider
.state('projects', {
url: '/projects',
views: {
'menu@""': {
template: 'Start your projects!'
},
'content@': {
templateUrl: "projects.html",
controller: 'ProjectsController',
onEnter: function(){
alert('hello onEnter');
},
onExit: function(){
alert('hello onExit');
}
}
}
})
.state('projects.create', {
url: '/create',
views: {
'outer@': {
templateUrl: 'projects.create.html',
controller: 'ProjectWizardController'
}
}
})
.state('projects.selected', {
url: '/:projectId'
})
});