Define optional url parameters

is there any thing in the ionic deeplinker system to define optional url parameters?

i mean maybe something like this:

	segment: 'fr-form/:?id'

because now if i didn’t send that parameter with the navigation it appear like this in the url:


Did you find an answer to this question? I am looking into the same thing.

nope, Seemingly no way to do that currently

Optional path params are a nightmare for parsers. Supporting them makes routing much more complex.

why mate ??

simply if i didn’t send that param replace that weird stuffs in the url path with empty string or something

It’s not so much what to put in elided parameters, but ambiguity in what goes where. Look at any old JavaScript function that has optional parameters and you will see lots of confusing and error-prone kludgery shifting things around.

In situations where parameters are named, this is no big deal, so, for example, query strings like ?foo=a&bar=b&baz=c is fine; we could drop any of these and it would be immediately clear what the remaining ones are.

When parameters are merely positional, there isn’t enough information to do that. :?foo/?bar/?baz isn’t tenable, because if we have fewer than 3 parameters given, we don’t know who to give them to.


i agree with u when it’s like :?foo/?bar/?baz it’s impossible to know who to give them to, but at least if i didn’t sent bar param for example don’t keep it in the url path, now it’s appear like this 4/?bar/6, simply appear it like this 4//6

i know i can do so by sending all parameters all the time and give it an empty string when i don’t need it, but that’s need more hard work

and i hope if we can use query string and define optional params with it, is that possible now ?

and also there’s another issue, now the only delimiter of url params is /, i tried some thing like - or even characters but i fail so that’s also need to implement into the deeplinker system

1 Like

Sort of, but only on device, I believe, which probably isn’t going to be particularly helpful.

I would be surprised if that ever changed. Path parameters work on paths, and / is the path separator in URLs.