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 like /path
, but how can I make something like a /path/to/the/resource
.
I don't know how much paths will it take, so I can't do .when("/!/:path1/:path2/:path3")
.
Any ideas?
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
As of now, AngularJS doesn't support regular expressions in routes.
Check these links: https://github.com/angular/angular.js/issues/918, https://github.com/angular/angular.js/pull/972