Yuyang He
Yuyang He

Reputation: 2272

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

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

Upvotes: 8

Views: 9460

Answers (4)

Lovely Chakraborty
Lovely Chakraborty

Reputation: 1

I am using ionic 4 angular <img *ngIf="imageUrl" src="{{imageUrl}}"> is works for fine for me.

Upvotes: 0

Mohamed Essam
Mohamed Essam

Reputation: 1

<img [src]="imageUrl || 'assets/images/defaultimage.png' ">

Upvotes: 0

Jignesh Mistry
Jignesh Mistry

Reputation: 2479

Add this & it will solve your query <img *ngIf="imageUrl" [src]="imageUrl">

Upvotes: 2

sebaferreras
sebaferreras

Reputation: 44659

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.

Upvotes: 20

Related Questions