Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created August 28, 2019 17:52
Show Gist options
  • Save alexzuza/b641076a2cb9b7ab09b2f33dbd242dd5 to your computer and use it in GitHub Desktop.
Save alexzuza/b641076a2cb9b7ab09b2f33dbd242dd5 to your computer and use it in GitHub Desktop.
Products html
<h2 class="title">Products</h2>
<div class="search-bar">
<input (input)="searchStream$.next($event.target.value)">
</div>
<div class="results">
<h3>Built-in solution</h3>
<div *ngIf="obs$ | async as obs">
<ng-template [ngIf]="obs.type === 'finish'">
{{obs.value}}
</ng-template>
<ng-template [ngIf]="obs.type === 'start'">Loading...</ng-template>
</div>
<h3>WithLoadingPipe</h3>
<div *ngIf="obs$ | withLoading | async as obs">
<ng-template [ngIf]="obs.value">{{ obs.value }}
</ng-template>
<ng-template [ngIf]="obs.loading">Loading...</ng-template>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment