As ionic V4 official documentation, its not possible. But you can use a trick via CSS.
Use <ion-img> tag inside message key of allert intead of <img/> tag
const loading = await this.loadingController.create({
message: '<ion-img src="/assets/svg/shopping.svg" alt="loading..."></ion-img>',
cssClass: 'scale-down-center',
translucent: true,
showBackdrop: false,
spinner: null,
duration: 2000
});
Create custom keyframes, you can also use this one to generate your own animation.
// CUSTOM ANIMATION KEYFRAMS********************
@-webkit-keyframes scale-down-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
}
@keyframes scale-down-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
}
// CUSTOM ANIMATION KEYFRAMS********************
Create custom class
.scale-down-center {
-webkit-animation: scale-down-center 0.6s cubic-bezier(0.175, 0.885, 0.320, 1.275) infinite alternate both;
animation: scale-down-center 0.6s cubic-bezier(0.175, 0.885, 0.320, 1.275) infinite alternate both;
}