Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <input type="search" class="form-control" placeholder="Search file" (keyup)="onSearch($) [(ngModel)]='searchKeywords'>
  2.  
  3. onSearch(event: any) {
  4. const keywords = event.target.value;
  5. if (keywords && keywords.length > 2) {
  6. const apiURL =`abc/thg/hjy?filter[file.name]=${keywords}`;
  7. this.api.get(apiURL).subscribe((data: any) => {
  8. console.log(data);
  9. this.topics = data.list;
  10. if (this.trigger) {
  11. this.trigger.openMenu();
  12. }
  13. });
  14. } else {
  15. this.topics = [];
  16. this.trigger.closeMenu();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement