Oliver Millington Oliver Millington - 1 month ago 5
AngularJS Question

Angular UI router 0.2.18 param on root url

I have an issue where I want to have a parameter on the route url e.g

$stateProvider.state('/someRoute', {
url: '/:path',

$stateProvider.state('/contact', {
url: '/contact',

But if I do that then other pages get misinterpreted as being part of this. for example /contact url thinks that "contact" is the param and not the page.

Is there a way around this or do I need to have a sub-page e.g /something/:path?


The issue is that currently due to the order of the states, your first state will capture all urls as it's expecting some parameter.

/contact satisfies the /:path criteria.

Either move the /:path as the last state. or create a /something/:path