I'm trying to set up a complex URL structure:
http://example.com/quote/:param1/:param2/:param3/:param4
Each state uses the same template except for 1.
My question being, is there a way to dynamically pass each parameter to the next state without having multiple templates? or do I need to set up individual templates and change only the ui-sref
Here are my states:
.state('quote', {
url: '/quote',
...
})
.state('quote.policy', {
url: '/',
templateUrl: 'partials/quote/quote.select.html',
page: {next: 'location'}
...
})
.state('quote.location', {
url: '/:policy',
templateUrl: 'partials/quote/quote.select.html',
page: {next: 'age'}
...
})
.state('quote.age', {
url: '/:policy/:state',
templateUrl: 'partials/quote/quote.select.html',
page: {next: 'income'}
...
})
.state('quote.income', {
url: '/:policy/:state/:age',
templateUrl: 'partials/quote/quote.income-select.html',
page: {next: 'priority'}
...
})
.state('quote.priority', {
url: '/:policy/:state/:age/:income',
templateUrl: 'partials/quote/quote.select.html',
...
})
Each param is collected with a child state of quote. They all use the same template:
snippet from partials/quote/quote.select.html
<label
ng-repeat="option in options[page.type]"
ui-sref="quote.{{page.next}}({ page.type : option.value })"
ng-click="formData.selections[page.type] = option.value">
Another issue I'm having is that the current ui-sref doesn't pass the value to the URL, i.e. doesn't append the new value.
quote.incomeshould bequote.policy.location.age.income? - haxxxton