your recipe card header background

    Angular Route Params Subscribe

    0

    0

    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 this.id variable to identify the particular id parameter that was requested.

    Library: angular

    Shortcut: angular.routes.params.subscribe

    this.route.paramMap
      .pipe(map(params => params.get('id')), tap(id => (this.id = +id)))
      .subscribe(id => {});
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.