What is a nice way to match url
for both /url.html
and /url.html/
in Angular.js ui-router?
For now, they are separate like this in my code:
$stateProvider
.state("myUrl1", {
url: "/",
resolve: {
init: function() {
console.log("Triggered resolve myUrl1 /");
return true;
}
}
})
.state("myUrl2", {
url: "^",
resolve: {
init: function() {
console.log("Triggered resolve myUrl2");
return true;
}
}
});
I have tried [^/]*}
in the doc https://github.com/angular-ui/ui-router/wiki/URL-Routing but no success.
Any pointer?
[/]*
at the end or if it is regex adding\/?
should work. – YOU Jan 3 at 7:52^[/]*
doesn't work (not being called at all) and^\/?
gave me error Invalid parameter name '' in pattern '/?' – HP. Jan 4 at 0:03