Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. ngOnInit() {
  2. this.displayLoader = true;
  3. this.subscription = this.httpClient
  4. .getSearch(this.pageSize, this.start)
  5. .subscribe(res => {
  6. const json = JSON.parse(String(res));
  7. this.data = json.items;
  8. this.dataLength = json.total;
  9. this.displayLoader = false;
  10. });
  11. }
  12.  
  13. ngOnDestroy() {
  14. this.subscription.unsubscribe();
  15. }
  16.  
  17. onPageChange(event) {
  18. if (this.subscription) {
  19. this.subscription.unsubscribe();
  20. }
  21. this.displayLoader = true;
  22. this.subscription = this.httpClient
  23. .getSearch(this.pageSize, 10)
  24. .subscribe(res => {
  25. const json = JSON.parse(String(res));
  26. this.data = json.items;
  27. this.dataLength = json.total;
  28. this.displayLoader = false;
  29. });
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement