The api information is showing in the console but not in the browser. Before I asked and one user said that I have to put
*ngIf = "catServ.length"
and then
*ngFor = "let item of catServ"
as you can see it here
<div *ngIf="catServ.length">
<h2 *ngFor="let item of catServ" class="text-3xl md:text-4xl font-extrabold tracking-tight leading-7 sm:leading-10 truncate" style="font-size: 20px!important;">
{{item.nombre}}
</h2>
</div>
But the console shows an error that did not recognize that.
this is my ts file to call the api from the server
this.http.get(this.apiserver.apiUrl + 'negocios/listadoTodos/?negocioCategorias=1').subscribe(deCat => {
this.catServ = deCat;
});
What can I do in this case? I want to see the information in the browser, and now is only showing in the console
Your questing does not clarify what you are actually trying to achieve.
Are you trying to get rid of the error? Do you want to see the data in the browser window?
I am going to assume you want to get rid of the error first
Add *ngIf="catServ && catServ.length" to avoid getting the error before catServ is initialized.
You can check the network tab to see the requests and check if you are getting any data back from the server
<div *ngIf="catServ && catServ.length">
<h2 *ngFor="let item of catServ" class="text-3xl md:text-4xl font-extrabold tracking-tight leading-7 sm:leading-10 truncate" style="font-size: 20px!important;">
{{item.nombre}}
</h2>
</div>