You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HttpParams get and getAll methods return type does not support number neither boolean #42637
I don't think this is actually a regression, since in v11 not only can you not pass a number into the HttpParamsOptions, the return type was also always string.
Actually, moreover, this is by design. The HttpParams is a map of keys to string values. It just happens that you can pass in non-string values when adding to the map, but these values get converted to and stored as strings.
If you want to compare non-string parameters, I think you would need to use an object or hash Map.
Actually, moreover, this is by design. The HttpParams is a map of keys to string values. It just happens that you can pass in non-string values when adding to the map, but these values get converted to and stored as strings.
If you want to compare non-string parameters, I think you would need to use an object or hash Map.
Activity
petebacondarwin commentedon Jun 24, 2021
I don't think this is actually a regression, since in v11 not only can you not pass a number into the HttpParamsOptions, the return type was also always string.
destus90 commentedon Jun 24, 2021
@petebacondarwin https://stackblitz.com/edit/angular-ivy-f5vglj
petebacondarwin commentedon Jun 24, 2021
Actually, moreover, this is by design. The
HttpParamsis a map of keys to string values. It just happens that you can pass in non-string values when adding to the map, but these values get converted to and stored as strings.If you want to compare non-string parameters, I think you would need to use an object or hash
Map.Closing as working as expected.
aanaya-deltacom commentedon Jun 24, 2021
@petebacondarwin it does not work as expected
If the parameter was stored as string in the map, then
typeof params.get('numericParam') === 'number', // trueshould be false, isn't it?petebacondarwin commentedon Jun 24, 2021
You are right! There is a bug. But not the one reported here.
We have this code in our constructor:
This should actually be:
When adding items subsequently, outside of the constructor, this is what happens to values.
angular-automatic-lock-bot commentedon Jul 25, 2021
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.