ui-router
ui-router copied to clipboard
reload only certain ui-views when transitioning to same state consecutively
Is following possible? I have two ui-views: "content" and "footer".
.state('root.content', {
views: {
'content@': {
templateUrl: 'content.html',
controller: 'ContentController'
},
'footer@':{
templateUrl: 'footer.html',
controller: 'FooterController'
}
params: ['somevar']
}
I invoke the "root.content" state consecutively with different parameters so that it's reloaded everytime. Now i want only one of both ui-views to be reloaded everytime (content - reload every time) but not the other (footer - reload only once when footer template changes).
Maybe use an abstract parent to set up the footer?
.state('root', {
views: {
'footer@': {
templateUrl: 'footer.html',
controller: 'FooterController'
}
}
})
.state('root.content', {
views: {
'content@': {
templateUrl: 'content.html',
controller: 'ContentController'
}
},
params: ['somevar']
})
Now when you transitionTo root.content with a new param only that state will load, but not its parent. The parent is only loaded the first time you transitionTo root.content.
Just what i wanted. Thank you!