【发布时间】:2019-04-26 22:11:04
【问题描述】:
我使用 Angular 6、Firebase 和 Angular Material。
我有 30,000 个 json 对象存储在 firebase 中,我想将它们加载到 mat-table 中。只有我比我希望的要低得多。我等了 30 秒才可以点击我的应用程序,有时 chrome 会出错...
但是我在分页后加载了我的数据。
谁能告诉我这是正常的还是有解决这个问题的策略?谢谢。
也许我可以用 Angular 7 和无限滚动来做到这一点?请问有例子吗?
export class TableComponent implements OnInit {
showSpinner = true;
Data = {nom: '', finessgeo: '', cat1: '', commune: '', CP: '', departement: '', tel: ''}
displayedColumns = ['nom', 'finessgeo', 'cat1', 'commune', 'CP', 'departement', 'tel'];
dataSource = new MatTableDataSource();
applyFilter(filterValue: string) {
filterValue = filterValue.trim();
filterValue = filterValue.toLowerCase();
this.dataSource.filter = filterValue;
}
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
return this.geoService.getGeos().subscribe(res => {
this.dataSource.data =
res;
this.showSpinner = false;
});
}
constructor(public authService: AuthService, private geoService:
GeoService, private router: Router, private database: AngularFireDatabase) {
}
ngOnInit() {}
}
【问题讨论】:
标签: angular performance firebase angular-material mat-table