我从数据库收到一个数组,当用物化绘画它时,会产生以下错误:
ListaPacientesComponent.html:42错误错误:找不到ID为“ identificacion_pac”的列。 在getTableUnknownColumnError(table.es5.js:671)
我的代码如下
'municipio_pac','direccion_pac','fecha_nacimiento_pac'];
constructor( private visorService: mySql) { }
ngOnInit() { this.iniciar();}
iniciar(){ this.visorService.getpacientes().subscribe( res => { this.datos = res this.dataSource = this.datos; console.log(this.dataSource);
},err => console.error('error visor',err)
);
}
}
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8"> -->
<ng-container matColumnDef="position">
<th mat-head *matHeaderCellDef> No. </th>
<td mat-cell *matCellDef="let element"> {{element.identificacion_pac}} </td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let element"> {{element.tipo_identificacion_pac}} </td>
</ng-container>
<ng-container matColumnDef="weight">
<th mat-header-cell *matHeaderCellDef> Weight </th>
<td mat-cell *matCellDef="let element"> {{element.nombre_pac}} {{element.apellido_pac}} </td>
</ng-container>
<ng-container matColumnDef="symbol">
<th mat-header-cell *matHeaderCellDef> Symbol </th>
<td mat-cell *matCellDef="let element"> {{element.municipio_pac}} </td> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>