pipe async angular code example

Example 1: why async pipe should be used in angular

Async pipe automatically unsubscribes the observable thus saving some lines of code
Async pipe utilizes on push change detection strategy which is good for performance.

Example 2: angular pass async pipe value to funciton

<div *ngIf="(match | async) as match" class="team" (click)="addToFavorite(match.id)">

Example 3: javascript pipe async functions

const pipeAwait = (...fns) => param => fns.reduce(async (result, next) => next(await result), param)