ionic3 GET http://localhost:8100/null 404 (Not Found)

Issue

Don’t know why always showing this error for me, but ionic3 project can run as usual.

This is what showing:
enter image description hereenter image description here

Solution

Please add some more code so we can point the exact cause of the error, but given that description, seems like you’re including an image somewhere in any of your pages, and the src of that image is being set dynamically after getting some information from the server, something like

<img [src]="imageUrl">

where imageUrl is a property from the component code.

The problem is that this imageUrl is null when Angular tries to load the page, so the source of the image is null (that’s why you get the 404 when trying to get an image from http:localhost:8100/null; that ending null is because that property is null when the image element is being created in the view).

You could prevent that error by adding an additional check, like

<img *ngIf="imageUrl" [src]="imageUrl">

so the image will only be added if the source is ready.

Answered By – sebaferreras

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published