Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Search">
  2.  
  3. applyFilter(filterValue: string) {
  4. filterValue = filterValue.trim();
  5. filterValue = filterValue.toLowerCase();
  6. this.scanService.getFilteringScans(filterValue).subscribe(response => {
  7. this.scans = response.results;
  8. this.next = response.next;
  9. this.previous = response.previous;
  10. this.scans_length = response.count;
  11. this.dataSource = new MatTableDataSource(this.scans.map(function(obj){return new ScanDetails(obj)}));
  12. });
  13. this.dataSource.filter = filterValue;
  14. }
  15.  
  16. getFilteringScans(param): Observable<ScanList> {
  17. return this.http.get<ScanList>(this.scansUrl + '?search=' + param).pipe(
  18. map(response => response),
  19. catchError(this.handleError)
  20. );
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement