// app.component.html
<div *ngIf="productSuppliers$ | async as suppliers">
<div *ngFor="let supplier of suppliers">
{{ supplier.name }}
</div>
</div>
// app.component.ts
productSuppliers$ = this.productService.productSuppliers$;
// product.service.ts
selectedProduct$ = ...
productSuppliers$ = this.selectedProduct$.pipe(
switchMap(product =>
forkJoin(
product.supplierIds.map(
supplierId => this.http.get<Supplier>(`${url}/${supplierId}`))
)
);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter