Matching url with array list of words in AngularJS ui-router

后端 未结 2 601
一向
一向 2020-12-03 09:06

Using AngularJS + ui-router, I need to match a url with list of words:

However, using a regex I have tried using one or 2 words and it worked

 url: \         


        
2条回答
  •  再見小時候
    2020-12-03 09:54

    Previous answers are ok, but I most of the time need something simpler solution like this:

     url: '/something/{source:(?:' + ['John', 'Paul'].join('|') + ')}/:id',
    

    without need for using $urlMatcherFactory

提交回复
热议问题