How do I get parameters for a state from a service? I have this state:
.state('cashbox.list', {
title: 'Cashbox',
url: '/:from/:to?q',
templateUrl: '/cashbox_list.html',
controllerUrl: 'controllers/CashboxCtrl.js',
controller: 'CashboxCtrl',
controllerAs: 'mainCtrl',
params: {
from: getCashboxParamFrom,
to: getCashboxParamTo
},
resolve: {
cashboxData: getTransactionsData
}
})
function getTransactionsData($stateParams)
{
return CashboxService.getTransactions($stateParams.from, $stateParams.to);
}
Now my problem is, that params from and to are dynamic and are fetched by another service. I need something like a resolve before the resolve to get the params. I already tried to operate with promises in getCashboxParamTo/From but the app then stops routing when going to state. Also tried to use a parent state with redirectTo into child state but don't find anything on how to dynamically create stateparams from resolved data in parent state.
.state('cashbox', {
title: trns('title.cashbox_list'),
url: '/cashbox',
redirectTo: {
state: 'cashbox.list',
params: HERE DATES FROM RESOLVE
},
resolve: {
dates: getFromToDates
}
})
Solutions with state.go won't work as I'm running into a 'The transition has been superseded by a different transition' issue.