Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
Api information is not shown in the browser Angular

enter image description here 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

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda