this.beds$ = this.wrcService.getWrcBedsByFilter(this.wrcId, workerTypeId, blockId, buildingId, floorId, ['100000002'])
.pipe(
tap(bedsResponse => console.log(bedsResponse)),
filter(bedsResponse => bedsResponse != null),
flatMap(beds => beds),
map(bed => {
bed.numberOfBedsArray = Array.from({length: bed.qty}, (v, i) => i + 1);
return bed;
}),
mergeMap(beds => beds)
);
bedsResponse
is of type Observable<Bed[]>
flatting
it to each Bed object
this.wrcService.getWrcBedsByFilter().pipe(map(beds => beds.map(...)))
should be enough right?
//set id if present
this.route.queryParams
.pipe(
map(param => param['id'])
)
.subscribe(paramValue => {
this.contractId = paramValue;
});
The same way I need to check for applicationId
var idQueryParamObs = this.route.queryParams
.pipe(
filter(param => param['id'] != null),
map(param => param['id'])
);
var applicationIdQueryParamObs = this.route.queryParams
.pipe(
filter(param => param[applicationId'] != null),
map(param => param['applicationId'])
);