How to reference query params in redirectTo

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

  1. callmepills

    callmepills Guest

    I would like to provide a path that redirects to a given page based on query parameters. For example:

    /redirect?page=hero&id=1


    should redirect to:

    /hero/1


    Is there any way to do this in the route config? Something like:

    { path: 'redirect?page&id', redirectTo: ':page/:id' }


    I can get the redirectTo to respect path parameters but not query parameters. Any ideas?

    Continue reading...

Compartilhe esta Página