Advertisement
aaa4Alex

ComponentA.ts

Sep 18th, 2020
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Component, OnInit} from '@angular/core';
  2. import {EntityService} from '../entity.service';
  3. import {EntityDto} from '../dto/EntityDto';
  4. import {PageEvent} from '@angular/material/paginator';
  5. import {Page} from '../dto/Page';
  6.  
  7. @Component({
  8.   selector: 'app-component-a',
  9.   templateUrl: './component-a.component.html',
  10.   styleUrls: ['./component-a.component.css']
  11. })
  12. export class ComponentAComponent<T extends EntityDto> implements OnInit {
  13.  
  14.  
  15.   length = 10;
  16.   pageSize = 20;
  17.   pageSizeOptions: number[] = [5, 10, 20, 30];
  18.   accounts: Page<EntityDto>;
  19.  
  20.    constructor(protected service: EntityService<EntityDto>) {
  21.    }
  22.  
  23.   ngOnInit(): void {
  24.   }
  25.  
  26.   getServerData(event: PageEvent): void {
  27.     console.log('requesting server data');
  28.     this.service.getPage(event).subscribe(p => {
  29.       this.accounts = p;
  30.       this.length = p.totalElements;
  31.     });
  32.   }
  33.  
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement