Test on device doesn’t display local images(www/img) ?!

Heeeey guys :smiley:
so i’m working on ionic app ,developping an app , my issue is
When serving the app using ionic serve there were no problems everything display properly in the browser . But when running it using ionic run --device the images cannot be rendered and after build app i want just to be sure that all img folder are generated but when i go to build folder especially in res folder there was no img res that i have in www/img may be they were not generated during build or something else .So during the test on physic device the images aren’t displaying plz help me how we can solve that ? anyway thnk u very much :smiley:

I don’t have my project here but I know it has something to do with the img path.
Try /img/your_image, img/your_image, one should work

first of all thnk u for sharing your knowledge ,so i’m trying that result is in html code img src=“img/logo.png” that’s work but in CSS background-image: url(’…/img/backImage.jpg’) doesn 't work :smiley:

Ok, now I have it with me, I’m checking, not always written the same, but it works, both on android and iOS

In CSS : background: url('../img/1080.png');

same for fonts :

@font-face {
    font-family: 'bnppf_sans_cond_light';
    src: url('../img/fonts/BNPP_Sans_Cond_Light.otf');

And In HTML :

<img src="./img/courrier.png">

And in JS :

document.getElementById('pave-digital')).append($compile("<img class = 'digitalKeypadImg' src='img/Images/"+ code + ".png'>

Another still in JS in a popup :

var alertPopup = $ionicPopup.alert({
                template: "<img src='./img/anim-alert.gif'></img>",
                cssClass: 'myPopup',
                buttons: [{
                    text: myTextHere

thnks greaat work :smiley: thnks brother

Glad I could help ! :smile:

1 Like