Using Angular 1.5 in an asp.net mvc site.
I have a base tag:
<base href="/fr/">
and html5mode is set.
The site works perfectly. I use ui-router... no issues. But today I hit one and this is when I try to browse to this kind of url:
I get an error from angular:
url is undefined
If I navigate to /fr/?arg=1 (with the trailing slash) the error goes away.
If I navigate to /fr/about/?arg=1, it will navigate to the index page but won't trigger the "about" state.
How to get the query string to work?
Update: setting strictMode to false, as @miqid proposed, fixed the issue for this url /fr/about/?arg=1 but not for the base /fr?arg=1
UrlMatcher
takes an argument namedstrict
that lets you customise the behaviour of URL matching when trailing slashes are involved. You can use this as theurl
property of a state to not require trailing slashes with query strings. – miqid Feb 11 at 0:09strictMode
and catching routes with or without trailing slashes. Do take a look - plnkr.co/edit/n9mRfw?p=preview – miqid Feb 12 at 3:22