AngularJS - Route - How to match star (*) as a path

后端 未结 2 498
甜味超标
甜味超标 2020-12-06 17:36

I\'m making a resource viewer app, but the problem is that i tried to match when(\"/!/:resourceUrl\").

It works fine if the resource url is something l

2条回答
  •  甜味超标
    2020-12-06 18:36

    As of angular-1.2 you can do this:

    when("/!/:resourceUrl*")
    

    http://code.angularjs.org/1.2.0/docs/api/ngRoute.$routeProvider

    In particular the documentation gives the following example:

    For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode /code/with/slashs/edit and extract:

    • color: brown
    • largecode: code/with/slashs

提交回复
热议问题