Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Component, OnInit} from '@angular/core';
- import {EntityService} from '../entity.service';
- import {EntityDto} from '../dto/EntityDto';
- import {PageEvent} from '@angular/material/paginator';
- import {Page} from '../dto/Page';
- @Component({
- selector: 'app-component-a',
- templateUrl: './component-a.component.html',
- styleUrls: ['./component-a.component.css']
- })
- export class ComponentAComponent<T extends EntityDto> implements OnInit {
- length = 10;
- pageSize = 20;
- pageSizeOptions: number[] = [5, 10, 20, 30];
- accounts: Page<EntityDto>;
- constructor(protected service: EntityService<EntityDto>) {
- }
- ngOnInit(): void {
- }
- getServerData(event: PageEvent): void {
- console.log('requesting server data');
- this.service.getPage(event).subscribe(p => {
- this.accounts = p;
- this.length = p.totalElements;
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement