I wonder if this is possible - I need to match the following URLs with one pattern:
/one/app/home
/one/two/app/home
/one/two/three/app/home
...
I understand that AngularJS routing doesn't support regex, but Angular UI Router does.
main.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
$urlRouterProvider.otherwise("/fail");
$stateProvider
.state("home", {
url: "{.+}/app/home",
templateUrl: "assets/tpl/home.html",
controller: "homeController"
})
$locationProvider.html5Mode(true);
});
This doesn't work though (goes to /fail with all the examples). Is what I want to do possible at all?
.+instead of{.+}, and add a$at the end to ensure theapp/homepart is the last one:.+/app/home${id:...}), or because the regex can't include a/(ie it's only applied between to slashes). But I'm not familiar with the specifics, so this is just a guess in the wild. Good luck!