Where should I put images?

Hello,

I am having the strange issue, the images are loaded first time when app is bootstrapped but when i change the route the images are broken. This happens in ionic 2

src="./assets/img/category.png" class=“section-title-img”

By using ./assets/... you are relative to the page loaded. Doesn’t it work to use assets/...?

Thank you for repose.

I have tried that as well.

@Sujan12

Got the solution.

src="/android_asset/www/assets/img/category.png"

This worked for me.

Thank you for your help.

3 Likes

This is the answer that worked for me. I guess it comes down to the fact that the compiled SCSS and html are in different places. Webstorm yells about me about the paths, but everything loads in the Browser and On-Device just fine.

finally! this and only this, worked for me

this one worked for me as well, thank you!

This worked both browser and mobile for me.

CSS: background: url(…/assets/imgs/flags/flags.png) no-repeat;
HTML: <img src="assets/imgs/content/info/about/slide1.jpg>

its work for me, thank you so much.