Angular Route Params Subscribe



    Jose Romero

    Angular TypeScript Recipes

    The code creates a custom pipe that uses the JavaScript map function to take the parameters from the route and pass them onto the tap function. The tap function then uses the variable to identify the particular id parameter that was requested.

    Library: angular

    Shortcut: angular.routes.params.subscribe

      .pipe(map(params => params.get('id')), tap(id => ( = +id)))
      .subscribe(id => {});
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.