【发布时间】:2020-10-12 01:15:26
【问题描述】:
我使用 asp.net 和 angular 7,我尝试恢复由带有 get ID 的表单保存的数据,这些数据很好地存储在本地存储中,但它没有显示在用户的前端,也没有显示的错误你能帮我吗 在组件中我有这个代码
export class DashboardComponent implements OnInit {
Syntheses: AddClient[];
currentSynthese: AddClient;
currentSyntheseSubscription:Subscription;
public currentSyntheseSubject: BehaviorSubject<AddClient>;
getByIdSynthese(idSynthese:number){
this.userService.getByIdSynthese(idSynthese).toPromise().then(res =>this.currentSynthese= res as AddClient);
}
在 HTML 中
<tr>
<td>{{currentSynthese.Date}}</td>
<td>{{currentSynthese.MCCD01}}</td>
<td>{{currentSynthese.MCCD02}}</td>
<td>{{currentSynthese.MCCD03}}</td>
<td>{{currentSynthese.MCCD04}}</td>
<td>{{currentSynthese.MCCD05}}</td>
<td>{{currentSynthese.MCCI01}}</td>
<td>{{currentSynthese.MCCI02}}</td>
<td>{{currentSynthese.MCCI03}}</td>
<td>{{currentSynthese.MCCI04}}</td>
<td>{{currentSynthese.MCCI05}}</td>
<td>{{currentSynthese.MACD01}}</td>
<td>{{currentSynthese.MACD02}}</td>
<td>{{currentSynthese.MACD03}}</td>
<td>{{currentSynthese.MACD04}}</td>
<td>{{currentSynthese.MACD05}}</td>
<td>{{currentSynthese.MACD06}}</td>
<td>{{currentSynthese.MACI01}}</td>
<td>{{currentSynthese.MACI02}}</td>
<td>{{currentSynthese.MACI03}}</td>
<td>{{currentSynthese.MACI04}}</td>
<td>{{currentSynthese.MACI05}}</td>
<td>{{currentSynthese.MACI06}}</td>
<td>{{currentSynthese.MOCD01}}</td>
<td>{{currentSynthese.MOCD02}}</td>
<td>{{currentSynthese.MOCD03}}</td>
<td>{{currentSynthese.MOCI01}}</td>
<td>{{currentSynthese.MOCI02}}</td>
<td>{{currentSynthese.MOCI03}}</td>
</tr>
并在服务中使用此代码
getByIdSynthese(idSynthese: number) {
return this.http.get(this.rootURL+`/AddClients/${idSynthese}`);
}
【问题讨论】:
-
控制台日志资源,它给你什么?
-
你在哪里给
getByIdSynthese()打电话? -
没有错误信息或导致控制台日志
-
我在组件中调用getbyIdSynthese
标签: html asp.net angular typescript angular7