分类 angular articles

Multiple Angular Material Table Sort

问题 在一个component里面,如果有多个mat-table matSort,怎么使用ViewChild 方案 使用ViewChild的时候,需要使用id @ViewChild('sort1') sort1: MatSort; 在页面中,需要 <mat-table #table [dataSource]="dataSource" #sort1="matSort" matSort>……

Continue reading

Angular Material Table Paginator ngIf

问题 一般来说,按angular material的官方文档, 在afterViewInit里面 可以把paginator或者sort和dataSource绑定在一起。但是如果这个table是在ngIf里面,也就是要在条件满足的情况下。这个时候的 @ViewChild(MatPaginator) paginator: MatPaginator; 可能就不好用了。因为还没有渲染,对应……

Continue reading