bug: ion-img ionError not fired on 404 error
See original GitHub issueBug Report
Ionic version: @ionic/angular 4.11.5
Current behavior: Ion-img events do not seem to work at all. Binding to ionError, ionImgWIllLoad and ionImgDidLoad does not seem to work, as bound methods are not fired.
Expected behavior: The events should fire as per [https://ionicframework.com/docs/api/img](this doc page).
Related code:
Full Stackblitz example: https://stackblitz.com/edit/ionic-pj8ehj
home.html (Non-Existing image):
<ion-img style="width:100px; height:100px; border: 1px solid red;" [src]="nonexisting" (ionImgWillLoad)="willLoad($event)" (ionImgDidLoad)="loadSuccess($event)" (ionError)="loadError($event)"></ion-img>
home.html(Existing Image):
<ion-img style="width:100px; height:100px; border: 1px solid red;" [src]="existing" (ionImgWillLoad)="willLoad($event)" (ionImgDidLoad)="loadSuccess($event)" (ionError)="loadError($event)"></ion-img>
home.ts
willLoad(event){
console.log("WILL LOAD");
}
loadError(event){
console.log("ERRORE");
console.log(event);
}
loadSuccess(event){
console.log("SUCCESS");
}
Other information: Seems like ionError was introduced with #15659 . Has anyone seen this working? Am i missing something?
Ionic info:
Ionic:
Ionic CLI : 5.4.9 (C:\Users\Matteo\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.5
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (2 plugins total)
Utility:
cordova-res : not installed
native-run : 0.2.7
System:
Android SDK Tools : 26.1.1 (C:\android_sdk)
NodeJS : v12.13.1 (C:\Program Files\nodejs\node.exe)
npm : 6.12.1
OS : Windows 10
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
bug: ion-img ionError not fired on 404 error · Issue #20039
Binding to ionError, ionImgWIllLoad and ionImgDidLoad does not seem to work, as bound methods are not fired. Expected behavior: The events ...
Read more >ionError Event not emitting when get 404 with ion-img
Hi all, I am sure that I am doing this correctly, but ionError event does not emit when I get 404 from pic...
Read more >Error events for failed load images in ionic tags - Stack Overflow
And i need to send an error event when the image failed to load, this (ionError) event is in the documentation of the...
Read more >How to Fix 404 Page Not Found Error [Step by Step] ☑️
In this video we will describe you what is 404 error pages from the perspective of both users and search engines, and will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m quite embarassed. I updated stackblitz to 4.11.5, and events are actually fired. I did a npm install on my project and everything seems to work fine now. Closing, thanks for the kind replies and sorry for wasting your time.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.