My Ionic2 application utilizes ion-img to properly load images, but I am seeking a way to notify the user that the picture is loading. Any suggestions would be greatly appreciated!
EDIT : If you must use the ion-img tag, here is the solution. Otherwise, consider using ionic-image-loader as recommended by AdminDev826.
To address this issue, I used CSS to style the ion-img tag. Initially, when an image is loading in Ionic2, the ion-img tag does not have any class. Once the image has loaded, the ion-img tag receives the "img-loaded" class.
Below is how I implemented the solution :
<ion-img [src]="img.src"></ion-img>
<ion-spinner></ion-spinner>
Here is the CSS I used :
.img-loaded + ion-spinner {
display:none;
}
I hope this can benefit someone else!