Closed
Description
It would be nice to have a reverse function in $state
to map state name and params to corresponding URI. For example:
$stateProvider
.state('foo.bar', {
url: '/{fooId}/{barId}'
});
then
$state.reverse('foo.bar', {fooId:1, barId:2})
generates URI string: '/1/2'
(or '#/1/2'
, depends on html5mode
)
Currently, this could be done by using $state.$current.url.format
for the current state or ancestor states, but not for the other such as sibling states. Comparing with concatenating strings, this way feels neat and better managed.
Metadata
Metadata
Assignees
Labels
No labels