使用Angular的mat-cell元素来显示JSON属性信息结构。
在HTML模板中,使用mat-cell元素并绑定相应的属性信息:
{{element.attribute_info}}
在组件中,定义表格列和数据源:
export class MyComponent implements OnInit {
displayedColumns: string[] = ['attribute_info'];
dataSource = ELEMENT_DATA;
ngOnInit() {
}
}
export interface Element {
attribute_info: string;
}
const ELEMENT_DATA: Element[] = [
{attribute_info: '属性1'},
{attribute_info: '属性2'},
{attribute_info: '属性3'}
];