.pipe(map(params => params.get('id')), tap(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 variable to identify the particular id parameter that was requested.

      Shortcut: angular.routes.params.subscribe


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.