sheenam12

Untitled

Sep 27th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. //HTML
  2.  
  3. <div class="col-lg-3">
  4. <div class="input-group" style="margin-top:15%;margin-left:200px;">
  5. <input class="pull-right" style="width: 150px;" placeholder="Search..." #mysearch [ngModel]="mymodel" (ngModelChange)="Search(mysearch.value)" (focusout)="Search(mysearch.value)" (keydown.backspace)="Search(mysearch.value)" (keypress)="Search(mysearch.value)" (keyup.enter)="Search(mysearch.value)"/>
  6. </div>
  7. </div>
  8.  
  9. //TS
  10. ngOnInit() {}
  11. @ViewChild("mysearch") mysearch;
  12. getPage(page){
  13. this.p=page;
  14. // this.getVerifiedUsers(page);
  15. if(!(this.mysearch.nativeElement.value)) {
  16. this.getVerifiedUsers(page);
  17. }
  18. else{
  19. var name = this.mysearch.nativeElement.value;
  20. this.Search(name,page);
  21. }
  22. }
  23.  
  24. //ADMIN SERVICE TS
  25. getSearchData(name,flag,page){
  26. var headers = this.getHeadersForMultipart();
  27. if(page!=undefined)
  28. var skip = (page - 1) * this.limit;
  29. else
  30. var skip =0;
  31. var body={skip:skip,limit:this.limit,name:name,flag:flag};
  32. return this.http.post(this.baseUrl+'searchData', body, {headers:headers})
  33. .map(response => response.json())
  34. .catch(this.errorHandler);
  35. }
Add Comment
Please, Sign In to add comment