区域感知承诺视图未显示



我的视图没有显示从服务层返回的数据。我可以在console.log中看到数据,因此我知道正在返回数据。视图中还有什么需要我补充的吗?

视图

<table class="adminConfig-settings-list  table">
<thead>
<tr>
<td>Name</td>
<td>Action</td>
</tr>
</thead>
<tbody>
<template ngFor let-status [ngForOf]="statuses">
<tr>
<td>
<b>{{statuses.ConfigName}}</b>
</td>
<td>
{{statuses.ConfigSetting}}
</td>
</tr>
</template>
</tbody>
</table>

服务日志数组服务日志数组中包含数据

get(): Promise<AdminConfigModel[]> {
console.log('Get AdminConfig');
console.log(this.apiUrls.Get);
var AdminConfig = this.http.get(this.apiUrls.Get, { headers: ServiceBase.headers }).map(x => <AdminConfigModel[]>x.json()).toPromise();
console.log(AdminConfig);
return AdminConfig;
}

index.ts

ngAfterViewInit() {
console.log(this.dataService.get().then(x => this.statuses = x));
this.dataService.get().then(x => this.statuses = x);
}

我认为在你的模板中应该使用status而不是statuses

交货。{{statuses.ConfigName}}应改为{{status.ConfigName}}

另一个类似。

最新更新