I am writing an internal tool for developers to use using Angular2 beta 15 supported by C # WebApi.
I am updating Angular2 as new versions are released
I have been using routing from day one, but now I need to add optional parameters. This is usually done using a query.
However, Angular2 includes optional parameters before querystring as follows:
http:
Initially, I realized that everything will be fine, although this is not what I'm used to. However, I came across situations where I need to have a "potentially dangerous Request.Path [s] value", for example "*" (to save links with a pre-populated regular expression search field).
I can recall several corrections, including:
- Substitute another character for * - means that developers need to know a special character to free the URL hand.
- Url encodes parameters - means that developers must know the value encoded by the URL in order to pass the URL for free.
- Exclude these parameters when they have special characters - the page still breaks if the developer freely passes the URL using *.
- Switching from preliminary request parameters to request parameters.
- Manage the request manually.
Most simple regular expressions are perfectly valid in a query without encoding, which means that both (4) and (5) are real solutions.
(5) it is possible, but I cannot imagine that I am the only one who has encountered this problem. I would prefer not to create my own workaround if there is a formal solution.
(4) is my preferred solution. Many of the old examples I found show optional parameters in querystring, so I hope that the logic still remains and that the double-colon version is just the default option.
Is it possible to tell the router to use the query parameters, rather than the comma-delimited data that it now does?
I searched both angular.io and stackoverflow and could not find the answers or anyone asking this question.
Thanks.
source share