【发布时间】:2021-11-29 19:53:48
【问题描述】:
这是我的 ngOnInit 方法:
async ngOnInit() {
return this.http.get(this.apiserver.apiUrl + 'negocios/listadoTodos/?negocio=1').subscribe(async (todos:any) => {
this.detalles = todos;
console.log(this.detalles);
});
}
我的控制台: enter image description here
我的 HTML:
<div class="text-lg font-bold leading-none" *ngFor="let item of detalles">{{item.nombre}} - {{item.sector}}</div>
我正在尝试使用我的本地主机上的 api,我想知道为什么它在控制台上可以工作,但在前端 html 中却没有。
【问题讨论】:
-
你能从 todos 中显示 console.log 吗?
-
能展示整个组件的html和ts代码吗?
标签: javascript angular typescript api