0

I am using Table with pagination component in my project.After importing the component,Even the default page size(i,e items per page)is 5 its showing full list(20).as shown in below image

enter image description here

In TS file inside the ngOnInit()

I have placed this.dataSource.paginator = this.paginator; has shown in below

ngOnInit() {
this.addsessionForm = this.fb.group({
  'startdate': [null, [Validators.required, ]],
  'lastdate': [null, [Validators.required, ]],
  'price': [this.amount, [Validators.required, Validators.pattern('[0-9-!@#$%*?*]+')] ],
});
  this.dataSource.paginator = this.paginator;

}

Can i declare this.dataSource.paginator = this.paginator; inside other ngOnInit() whether it's a right way or not?

PGH
  • 2,164
  • 9
  • 34
  • 62

0 Answers0