merge two ParamMap angular

Discussão em 'Angular' iniciado por A. Gladkiy, Outubro 21, 2024.

  1. A. Gladkiy

    A. Gladkiy Guest

    I have the following code that works fine:

    let urlParameters = combineLatest(
    [this.route.params, this.route.queryParams], (params, queryParams) => ({
    ...params, ...queryParams
    }));

    urlParameters.subscribe(params => {
    console.log(params["type"]);
    });


    in the result I have new object and can access as params["type"]

    but can I do the same with queryParamMap and paramMap? like:

    let urlParameters = combineLatest(
    [this.route.paramMap, this.route.queryParamMap], (params, queryParams) => ([
    ...params, ...queryParams
    ]));

    urlParameters.subscribe(params => {
    console.log(params.get("type"));
    });


    and I can use ParamMap methods like params.get("type")

    Continue reading...

Compartilhe esta Página