【发布时间】:2018-09-02 03:02:33
【问题描述】:
我尝试捕获我的 category[] 的所有内容,但我想输入里面的信息,因为有时里面有几个列表。这是我的代码
HTML
<ng-container matColumnDef="category">
<mat-header-cell *matHeaderCellDef> category </mat-header-cell>
<mat-cell *matCellDef="let radios ">
{{radios.categories}} --> Get all categorie but not the content inside
</mat-cell>
</ng-container>
组件
ngOnInit() {
this.componentService.getNewlist()
.then(result => {
if(!result){
return;
}
this.getresult = result;
let promises: any[];
this.getresult.forEach(item=>{
this.radiosService.getCategid(item.id).then(categories=>{
promises = categories;
item['categories'] = promises;
console.log(promises); <--- GET ALL CONTENT OF MY I get all the information of my category depending on my id
})
});
})
.catch(reason => {
console.log(reason);
});
}
表格
在我的桌子上显示我:
[对象对象]、[对象对象]、[对象对象]
我想使用 ngfor 或 [ngForOf] 访问里面的信息
我想用一个来检查我的类别以获取其中的数据, 尝试使用 *ngFor = "let item of categories;" // {{radios.categories.item.description}} 但它不起作用,你能帮帮我吗?
【问题讨论】:
标签: angular angular-material ngfor