async pipe in angular function 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)">