Monday, February 17, 2020

I cannot hide the mat-paginator tag for a MatPaginator with *ngIf in an Angular 8 application without sabotaging the tag when it should work.

Well this suggests jamming this in the tag like so:

[ngStyle]="{display: isLargeScreen ? 'block' : 'none'}"

 
 

In the TypeScript class for your component you probably also want to conditionally turn off the MatPaginator's assignment.

if (this.isLargeScreen) {
   this.dataSource.paginator = this.paginator;
}

No comments:

Post a Comment