this.route.paramMap
        .pipe(map(params => params.get('id')), tap(id => (this.id = +id)))
        .subscribe(id => {});

      Typescript language logo
      your recipe card header background
      Angular Route Params Subscribe

      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.

      Shortcut: angular.routes.params.subscribe

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.