Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load Images in Angular + Cordova App

I got my Angular 5 app working with Cordova. The only problem is the images are not loading. The path I'm specifying looks like this:

/assets/img/logo.png

I use these paths for images:

<img class="logo-img" src="/assets/img/logo.png">

as well as inside the styles:

background: url(/assets/img/success-backg.png) no-repeat center center;

This is occurring for Android and iOS builds.

Any suggestions?

like image 649
pangular Avatar asked Jan 19 '26 03:01

pangular


1 Answers

I fixed this by replacing '/assets/..'. with './assets/...'. I'm facing issues with building sass files with relative paths and at the moment have to do the replacement right inside the output files (after ng build --prod). Probably Angular CLI has some option for handling this too.

like image 142
pangular Avatar answered Jan 21 '26 21:01

pangular



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!