Add case insensitive (query) param map (CaseInsensitiveParamMap) #55968
Labels
area: router
feature
Issue that requests a new feature
freq1: low
P5
The team acknowledges the request but does not plan to address it, it remains open for discussion
Milestone
Which @angular/* package(s) are relevant/related to the feature request?
router
Description
A very common issue seems to be to get a (query) parameter in a case insensitive way.
wrong hypothesis
More back-story: This seems to happen, becausethis.router.navigate
also seems to lower-case all query parameters you pass it in:This results in.../?login=abc
on the current page. (I may create a new bug for this, if that is not intentional.)Anyway, there may be other reasons to ignore the casing. And I tried...
E.g. I want to use query parameters for filtering data with specific terms in my application, so I can do this:
In contrast to using
params
(Params) directly, it does not throw,Now, if I pass
...?login=blaBlub
this works, but if I do pass...?Login=blaBlub
it does not as the usualconvertToParamMap
/param map is case-sensitive, apparently.Proposed solution
Full credit goes to Bradley Carey, who has developed a
CaseInsensitiveParamMap
including test cases etc.Maybe it can just be integrated in some way or another into Angular?
Alternatives considered
Any similar solution could also be developed? Like adding a flag to the existing
ParamsAsMap
:angular/packages/router/src/shared.ts
Line 75 in 87c5f3c
Also, it should probably support localization i.e. use
toLocaleLowerCase
or the Angular equivalent.The text was updated successfully, but these errors were encountered: