I have this service in my Angular Project
getOfertas(): Observable<Oferta[]> {
return this.http.get<Oferta[]>(`${this.urlWebAPI}/ofertas`)
.pipe(
tap(data=>console.log('OfertasService-get(): ', data)
),
catchError(this.handleError)
)
}
That I use in my Angular Component.ts
ofertas:Oferta[]=[];
ngOnInit(): void {
this.dataService.getOfertas()
.pipe(
tap(item=>console.log(item))
)
.subscribe(
data=>{
this.ofertas=data;
this.ofertasOriginal=this.ofertas;
}
)
,err=>console.log(err),
()=>{};
}
}
And I want to see the result in my table inside this Component.html
<div class='table-responsive'>
<table class='table'>
<thead>
<tr>
<th>Id</th>
<th>Id Presentada</th>
<th>Descripción</th>
<th>Organismo</th>
<th>Fª Presentación</th>
<th>Presupuesto</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let oferta of ofertas; let index=index">
<td>{{oferta.id}}</td>
<td>{{oferta.idPresentada}}</td>
<td>{{oferta.descripcion}}</td>
<td>{{oferta.id}}</td>
<td>{{oferta.fechaPresentacionFulcrum}}</td>
<td>{{oferta.id}}</td>
</tr>
</tbody>
</table>
</div>
But I get this result in console with the data obtained from the ASP.NEt Core web API but the error showed
In my Web API when I debug I see this result returned.
that is, a List of Oferta Objects
But in Angular, I get an strange object
{$id:
$values:[]
}
But If I use this ~$values to iterate I still see nothing
<tr *ngFor="let oferta of ofertas.$values; let index=index">
If I try to assign this
I want to use my ofertas variable ofertas:Oferta[]=[]
Here I have an example with the same problem; https://stackblitz.com/edit/angular-ivy-ymtnrw?file=src/app/app.component.html
Any idea, please?
Thanks


