Where to place external assets?

Has anyone had any experience with custom assets and where to place them within the project? I have an assets folders with images that are to be used within the app, and i tried placing it in the www folder, and while it works in the browser, the images can’t be reached in an emulator or a real device. If I place it within the build forlder, it works fine, but the build folder doesn’t really exist before the initial build, and it seems like there should be a better way.

Anyone solved this problem?

My images are placed in a www/img folder and they display ok on the device.

Hmm, how are you referencing them? I’ve tried several paths and use this for now, but it doesn’t work on the device:
<img [hidden]="title" class="logo" src="../img/logo.svg">

(So up one level from the build folder, and into the img-filder, but it seems the project doesn’t have access outside the build folder.)

Here’s an example of what I do:

<ion-avatar item-left>
<img src="img/{{entry.Photo}}.jpg">
</ion-avatar>

check your ionic.config.js - maybe there’s something wrong in there?

Take in account that the relative paths from any html file are actually being called from the index.html path as that’s the entry point and all other html gets embedded in it.

1 Like