Why Json data not working on device?


#1

Hello my app work’s on browser, but some stuff I can’t see in emulator/phone.
for example :

< img ng-src="{{DefinitionCtrl.checking.feedbackMessage.img}}" class=“image-definition”>

the data is loaded from JSOn, any solution?

a) Everything work on Browser, but not on Device.
b) if i put brutal path’s it works… like src=“images/blabla.png” on Device
c) When i made < span ng-bind=“DefinitionCtrl.checking.feedbackMessage.img” /> it returns me the right path even on Device.

Any solution? Sorry for my English :smiley:


#2

Is the image path actually available from the device? Is it a local image?


#3

Yeah it’s local image when i write {{DefinitionCtrl.checking.feedbackMessage.img}} it’s return me local path.


#4

And the image definitely exists locally at that exact path? If you hard code the exact same value into the src attribute of an image it will display?


#5

Yea - i find where’s problem when i build apk it’s add prefix to every image - and in this way the path dosn’t change. Any solution :)?


#6

Not sure what you mean exactly. Example?
You probably just need to split the path from wherever it becomes relative to the www root of your app.


#7

Well i solved the problem it wasn’t Ionic problem so i sorry for messing up here. If someone have the same problem - Gruntfile add prefix to images and if u declare this way {{DefinitionCtrl.checking.feedbackMessage.img}} it’s not working :slight_smile:


#8

I always leave the grunt img naming out when doing dev builds. Saves a bunch of headaches.