Last active
October 19, 2018 22:00
-
-
Save LayZeeDK/5b253d24984649aae947fedd1d23dd37 to your computer and use it in GitHub Desktop.
Search component with search BLoC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div cdkTrapFocus [cdkTrapFocusAutoCapture]="false"> | |
<mat-form-field appearance="outline" style="width: 80%;"> | |
<input | |
matInput | |
placeholder="Search for..." | |
ngModel (ngModelChange)="bloc.query.next($event)"> | |
</mat-form-field> | |
</div> | |
<span> {{ bloc.preamble$ | async }} </span> | |
<ul> | |
<li *ngFor="let result of bloc.results$ | async"> | |
{{ result }} | |
</li> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { SearchBloc } from '../../business-logic/search'; | |
@Component({ | |
selector: 'app-search', | |
styleUrls: ['./search.component.css'], | |
templateUrl: './search.component.html', | |
}) | |
export class SearchComponent { | |
constructor(public readonly bloc: SearchBloc) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment