Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): allow number or boolean as http params #40663

Closed
wants to merge 1 commit into from

Commits on Feb 22, 2021

  1. fix(common): allow number or boolean as http params

    This change fixes an incompatibility between the old `@angular/http` package
    and its successor (`@angular/common/http`) by re-introducing the types that were supported before.
    
    It now allows to use number and boolean directly as HTTP params, instead of having to convert it to string first.
    
    Before:
    
        this.http.get('/api/config', { params: { page: `${page}` } });
    
    After:
    
        this.http.get('/api/config', { params: { page }});
    
    `HttpParams` has also been updated to have most of its methods accept number or boolean values.
    
    Fixes angular#23856
    
    BREAKING CHANGE:
    
    The methods of the `HttpParams` class now accept `string | number | boolean`
    instead of `string` for the value of a parameter.
    If you extended this class in your application,
    you'll have to update the signatures of your methods to reflect these changes.
    cexbrayat committed Feb 22, 2021
    Configuration menu
    Copy the full SHA
    98eb8b4 View commit details
    Browse the repository at this point in the history