I have a request to add in another URL parameter that directs to a state that I already have set up. For efficiency purposes, I'm trying to see if I can add multiple URLs to point to the same state, or should I just use the $UrlRouterProvider.when() method to re-direct to that state in this new case.
Ex. this is what already exists
.state('site.link1', { url: '/link1', templateUrl: '/views/link1.html', controller: 'link1Ctrl' })
and the request is to add www.site.com/newlink that points to the link1 page. Is there something like this;
.state('site.link1', { url: '/link1, /newlink', ...
You use params:
https://github.com/angular-ui/ui-router/wiki/URL-Routing
.state('site.link', { url: '/{link}' .. }
so when you use the same state like this
$state.go('site.link', {link: 'link1'}) $state.go('site.link', {link: 'link2'})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With