AngularJs UI router – one state with multiple URLs

Try using the Regex and a parameter in the url. It is not optimal but works.

.state('site.link1',
 {
   url: '/{path:link1|newlink}',
   templateUrl: '/views/link1.html',
   controller: 'link1Ctrl'
 })

More information on regex in Urls.

To generate links with ui-sref pass the same parameter with the state name as a function

<a ui-sref="site.link1({path:'link1'})" >site link 1</a>
<a ui-sref="site.link1({path:'newlink'})">site new link</a>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)