I have been writing an internal tool for use by developers using Angular2 beta 15 backed by a C# WebApi.
I up the Angular2 version as new versions are released
I have been using routing from day 1 but now I need to add optional parameters. Typically this is done via the querystring.
However, Angular2 includes optional parameters before the querystring like so:
http://www.example.com;a=b;c=4
Originally I figured that would be fine, even though it isn't what I am used to. However, I have now run into cases where I need to have "potentially dangerous Request.Path value[s]" such as "*" (for saving links with a regular expression search field pre-populated).
I can think of several fixes including:
- Substitute a different symbol for * - Means that developers must know the special symbol in order to free hand a url.
- Url encode the parameters - Means that developers must know the url encoded value to free hand a url.
- Exclude those parameters when they have special characters - the page still breaks if a developer free hands the url using *.
- Switch from pre-querystring parameters to querystring parameters.
- Manually control the querystring.
Most simple regular expressions are perfectly valid in the querystring without encoding, this means that both (4) and (5) are valid solutions.
(5) is possible, but I can't imagine I am the only one who has run into this issue. I would rather not create my own workaround if an official solution exists.
(4) is my preferred solution. Many of the older examples I have found show the optional parameters in the querystring, so I hope that the logic still remains and that the semi-colon version is simply the default option.
Is it possible to tell the router to use querystring parameters instead of the semi-colon delimited stuff it does now?
I searched both angular.io and stackoverflow and could not find any answers or anyone asking this question.
Thanks.