// app.component.html
<div *ngIf="products$ | async as products">
<button *ngFor='let product of products'>
{{ product.name }}
</button>
</div>
// app.component.ts
products$ = this.productService.products$;
// app.service.ts
products$ = this.http.get<Product[]>(this.url)
.pipe(
tap(console.log),
catchError(this.handleError)
);
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