I am using Angular UI-Router and need to have a single parent state that several other states can inherit the results of a resolve from. I have tried every solution found here on SO for this but NOTHING is working. My states look like this:
.state('transaction', {
abstract:true,
url: '/register/pos/:screen/:document_sid',
template:'<div ui-view></div>',
resolve: {
Document: //the thing I need to have all the children access
}
})
.state('transaction.view', {
url:'',
views:{
'':{
templateUrl: '/views/docs/pos-transaction-outer-partial.htm',
controller:'posdocumentController'
}
}
})
.state('transaction.edit', {
url: '/:mode',
views:{
'':{
templateUrl: '/views/docs/pos-transaction-outer-partial.htm',
controller:'posdocumentController'
}
}
})
.state('transaction.returns', {
url: '/returns',
views:{
'':{
templateUrl: '/views/pos-itemreturn-partial.htm',
controller: 'posItemReturnsController'
}
}
})
When I use $state.go('transaction.edit') it works perfectly. Inside the 'posdocumentController' I have a function that calls $state.go('transaction.returns') and I can see the route change and the partial is requested, but the view never changes. According to the docs for multiple named views the specified views should load in the parents ui-view that is contained within the template. Obviously, for me this is not happening and for the life of me I have not been able to figure out why. I've tried this both with and without the views option and get the same results. Can someone explain why and how I fix this?