Adding new assets to ionic project

I am new to ionic framework and trying out some samples.

I added a new .jpg under www–>img folder. When I run the project in a web browser using ionic serve command, I could see the .jpg rendering in the browser but when I run ionic emulate android command, the .jpg is not rendering, it seems to be broken.

Any idea how to resolve this.

thanks,
-dharma

Hi dharma

You need to rebuild to project with

ionic build <platform>

regards

Patrick

Hi Patrick,

I tried that but still t he .jpg is not rendering in the emulator.

Please find the attached screen shot.

thanks,
-dharma

@dharma

A similar issue was discussed a while ago. Check it out: Images from image tag not loading in iOS emulator

Once you add the assets to your folder www/img be sure you include it in your project using this:

<img ng-src="img/picture.png" width="80">

Make sure there is no / before the src url. This fixed it for me.

Once you do this be sure to rebuild your app as @patrickdu mentioned. In your case substitute <platform> with android

Hope this helps.

1 Like

Hi dharma

Can you look in the folder /platforms/android/www if you can find the same asset.

regards

Patrrikc

Hi @dharma,

please check -

may be you will get solution.

@tjflamezz - thanks for your suggestion. That worked for me. I replaced src with ng-src and made sure there is no / before the ng-src url

thanks,
-dharma

This fix doesn’t work for me!! [Android Lollipop]