Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

386
Vistas
show full image after load is completed in Angular 12

I read image src with API from server . I want the image not to be displayed until it is completely loaded and to display the skeleton instead while loading(images are displayed in sections and I want the skeleton to be destroyed when the image is fully displayed) this is my code but it is not working as expected

HTML:

<div class="col-12 p-0">
     <ngx-skeleton-loader *ngIf="imgLoad == false" count="1" [theme]=" 
         {'borderradius':'7', 'background-color': '#ccc','margin-top':'0', 'min-height': 
         '25vh','width':'100%' }"></ngx-skeleton-loader>
     <img (load)="loadImage()" [hidden]="imgLoad == false" src="assets/image/job1.jpg" 
         alt="" class="w-100 h-auto image-border">
  </div>

TS :

imgLoad:boolean = false;


  loadImage(){
    this.imgLoad = true;
  }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

right now you read image from assets not API server!

but I try your code and change *ngIf="imgLoad == false" to *ngIf="imgLoad === false" & [hidden]="imgLoad == false" to [hidden]="imgLoad === false", so it's work fine

the stackblitz link: https://stackblitz.com/edit/angular-nnefsj?file=src/app/app.component.html

Just set your favorite width and height for skeleton and image.

If you need to use scr from a service in ts file just use [src] in img tag.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda