I've faced with the following problem: background-image from the scss file isn't showing when i'm building android apk by ionic build android
command
Ionic 2 RC0
.image-fav {
...
background-image:url(assets/img/remove.png);
}
The picture located in src/app/assets/img/remove.png
When i'm trying the app from the browser with ionic serve
all works fine
The same problem
Check the path to your image, where assets are kept changed relative to where pages are in the move to RC0. I have the following in the scss for one of my pages to display a background image and once I adjusted the path to the image all works as expected on device.
.cached-home {
background-image: url('../assets/img/crowdsun.jpg');
background-repeat:no-repeat;
background-size:cover;
width:100%;
}
@ghenry22, it helped to me, thanks.
Add your images to src/assets/imgs
directory
Set image path in HTML like
<img src="assets/imgs/example.jpg">
background-image: url(../assets/imgs/example.jpg);
It will work browser, emulator and build
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
SOLVED
Add your images to
src/assets/imgs
directorySet image path in HTML like
<img src="assets/imgs/example.jpg">
background-image: url(../assets/imgs/example.jpg);
It will work browser, emulator and build