Trying to figure out how to have a completely optional parameter for a state so that having a query string on the URL of what otherwise would be the home state(/) will actually route to the search state. Not sure if Regex here is even the proper approach.
URL -> State mapping
- url
/
should go to statehome
- url
/?search=
should go to statesearch
- url
/?search=foo
should go to statesearch
- url
/:slug/
should go to statesearch
- url
/:slug/?search=foo
should go to statesearch
Home State
name: 'home',
url: '/',
component: 'appHome',
Search State
name: 'search',
url: '/{slug: [.*]?}?search=',
component: 'appCategory',
params: {
slug: { dynamic: true },
search: { dynamic: true },
},