Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 5x 5x 5x 1x 1x 1x | import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { MatInput } from '@angular/material/input';
import { GithubSearchController } from '../../../github-search.controller';
@Component({
selector: 'app-github-search-search-box',
templateUrl: './github-search-search-box.component.html',
styleUrls: ['./github-search-search-box.component.scss'],
})
export class GithubSearchSearchBoxComponent implements AfterViewInit {
@ViewChild(MatInput) searchInput!: MatInput;
searchTerm: string = '';
constructor(private controller: GithubSearchController) {}
ngAfterViewInit(): void {
this.controller.focusSearchInput$.subscribe(() => {
this.searchInput.focus();
});
}
submit(): void {
this.controller.setSearchTerm(this.searchTerm);
}
clearSearchTerm() {
this.searchTerm = '';
}
}
|