Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Data is shown in the console but not in the website Angular

This is my ngOnInit method:

async ngOnInit() {
    
    return this.http.get(this.apiserver.apiUrl + 'negocios/listadoTodos/?negocio=1').subscribe(async (todos:any) => {
        this.detalles = todos;
        console.log(this.detalles);
        
      });
    
}

My console: enter image description here

My Html:

<div class="text-lg font-bold leading-none" *ngFor="let item of detalles">{{item.nombre}} - {{item.sector}}</div>

Im trying to use an api that is on my localhost and idk why at the console it is working but not in the frontend html.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your API might tacking time to load data so when API call get data it will print data in console but before that your HTML render on browser, so you need to use *ngIf before you *ngFor like this.

<div *ngIf="detalles.length">    
    <div class="text-lg font-bold leading-none" *ngFor="let item of detalles"> 
         {{item.nombre}} - {{item.sector}}
    </div>
</div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!