I have a service carriersService
with method getAll()
, which returns an Observable<Carrier[]>
.
In my component, I'm trying to read route parameter carrierId
, find the carrier with such carrierId
and assign it to a local variable
let carrier = null;
this.route.paramMap.pipe(
switchMap(
(params: ParamMap) => this.carriersService.getAll()));
I need to find a single Carrier from an Observable of Carrier[]
using params.get('carrierId')
and assign it to local carrier variable.