我正在使用Angular 5,Material Component和firebase进行数据库目的的项目 . 我在整个表的物料网格中有一个数据,即客户端 . 我点击了视图图标,它必须显示子组件中的单个客户端数据,但是材料表需要与数据源绑定,但我无法将单个客户端日期绑定到数据源 . 单击“查看”功能后,它将导航到client-detail.component

client.component.html

<ng-container matColumnDef="action">
      <mat-header-cell *matHeaderCellDef>
        <b>Action</b>
      </mat-header-cell>
      <mat-cell *matCellDef="let item">
                <i class="material-icons" style="cursor: pointer;" (click)="onView(item)">visibility</i>
      </mat-cell>
    </ng-container>

client.component.ts

onView(prod){
    this.router.navigate(['./',prod.prodid,'view'],{relativeTo: this.route});
  }

client-detail.component.ts

displayedColumns = ['no', 'name', 'cemail', 'address', 'country', 'projects', 'proposallist', 'quotationlist'];
  dataSource = new MatTableDataSource<Client>();
  dataProject = new MatTableDataSource<Project>();

  projects: AngularFirestoreCollection<any> = this.pro.collection('project');
  projectsarray: Array<any>;
  dataproject = this.projects.valueChanges();

  applyFilter(filterValue: string) {
    filterValue = filterValue.trim(); 
    filterValue = filterValue.toLowerCase(); 
    this.dataSource.filter = filterValue;
  }

  @ViewChild(MatSort) sort: MatSort;
  @ViewChild(MatPaginator) paginator: MatPaginator;

  ngAfterViewInit() {
    this.dataSource.paginator = this.paginator;
    this.dataSource.sort = this.sort;
    this.clientservice.getClient().subscribe(data => {
      this.dataSource.data = data;
    })
  }