Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (21 sloc) 783 Bytes
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
import {fromEvent, Observable} from 'rxjs';
import {debounceTime, distinctUntilChanged, map, tap} from 'rxjs/operators';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements AfterViewInit {
title = 'ngx-markjs-demo';
@ViewChild('search', {static: false}) searchElemRef: ElementRef;
searchText$: Observable<string>;
searchConfig = {separateWordSearch: false};
ngAfterViewInit() {
this.searchText$ = fromEvent(this.searchElemRef.nativeElement, 'keyup').pipe(
map((e: Event) => (e.target as HTMLInputElement).value),
debounceTime(300),
distinctUntilChanged()
);
}
}
You can’t perform that action at this time.