Reputation: 1555
Can I do this at all? Sorry very new to angular
this.route.paramMap
.pipe( map( p => p.get( 'id' ) ) )
.pipe(
switchMap( id => this.MyService.getMyProjectData( +id ) ),
map( items => this.MyListMapper( items, +id ) ) // I want to pass the id here from first pipe
)
In the second pipe, I want to use the same parameter value
Upvotes: 1
Views: 107
Reputation: 10790
Yes, you can :
this.route.paramMap
.pipe(
map( p => p.get( 'id' ) ) ,
switchMap( id => this.MyService.getMyProjectData( +id )
.pipe( map( items => this.MyListMapper( items, +id ) ) )
)
);
Upvotes: 2