Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ngOnInit() {
- this.displayLoader = true;
- this.subscription = this.httpClient
- .getSearch(this.pageSize, this.start)
- .subscribe(res => {
- const json = JSON.parse(String(res));
- this.data = json.items;
- this.dataLength = json.total;
- this.displayLoader = false;
- });
- }
- ngOnDestroy() {
- this.subscription.unsubscribe();
- }
- onPageChange(event) {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- this.displayLoader = true;
- this.subscription = this.httpClient
- .getSearch(this.pageSize, 10)
- .subscribe(res => {
- const json = JSON.parse(String(res));
- this.data = json.items;
- this.dataLength = json.total;
- this.displayLoader = false;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement