1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to maintain query params when redirecting in Angular RoutingModule with redirectTo?

Discussão em 'Angular' iniciado por times29, Setembro 10, 2024.

  1. times29

    times29 Guest

    Summary


    I want to redirect in my Angular RoutingModule from one path to another while maintaining the query params. However, when the redirect completes, the query params are not present anymore.

    The use case here is that our UIs offering deep links are supposed to have the deep links start with a certain path: /views. However, the displayed components belong to separate Angular modules, therefore I want to redirect to the pages in the respective modules.

    Example

    Deep link should redirect to but redirects to
    /views/createNewFoo?type=a&date=2024-01-01 /foo/create?type=a&date=2024-01-01 /foo/create
    Route Config


    {
    path: 'views',
    pathMatch: 'prefix',
    children: [
    {
    path: 'createNewFoo',
    redirectTo: '/foo/create'
    }
    ]
    }

    Continue reading...

Compartilhe esta Página