Image displaying issue with ng-repeat

I have a json of image name. i am displaying image using ng-repeat. That is not working.

<ion-slide-box on-slide-changed="slideChanged(index)">
            <ion-slide  ng-repeat="index in practicSupportSlideMenuDisplay">
                <div id="contant"  class="slideContent">
                    <div class="imageBackground">
					<div class="image"><img  style="width: 100%"  ng-src='img/{{index.supportIndexDetailImg}}.png' ></div>
                    <div class="display-contant">
                        <div class="padding">
                            <button type="button" id="submit" class="button" ng-click="downloadeFileFromServer()">Get a Copy</button>

If i am using hard coded like
"<img style="width: 100%" src="img/practic_support_display_center_btn_bg.png">"
and if i using base64 image url the windows phone 8 app giving performance issue.

Is there any solution…?? please reply …

Try replacing the src with ng-src? Any chance you could put a codepen together?

@ mhartington :- In both case.

Ah didn’t see the ng-src in the pasted code. Is this on android or iOS? Which version of ionic are you using? Are the images local or are the being loaded from a server?

I am also having the same issue from past three days. I working on android device.

I am getting list of images and path say (content://media/external/images/media/17); when i tried to bind to its not working. seems there is some issue. any idea. (Image is a servicet which contains its path). (Basically, Path=“content://media/external/images/media/17”).

@ mhartington :-
I am developing app for windows phone 8 and image being loaded from local from “img” folder
But i try both ng-src and src. it is not working.

Ah alright, if it’s windows phone, a thing to remember is that any kind of src-urls have to be whitelisted.

See this post on stack overflow.

Because the web view on windows phone is IE, you have to deal with all the issues that come with IE…

Then what should i do?Tell me any solution for that?
But In IE browser. src and ng-src is working on PC.

If you read the stack overflow post, you’ll see that you have to white list the url to your images in your config set up.

.config(function ($stateProvider, $urlRouterProvider, $compileProvider) {

Does index.supportIndexDetailImg has the same value as "practic_support_display_center_btn_bg"?

If the image URI starts with content:// or file://, it won’t work. If that’s the case, then just change to src="{{index.supportIndexDetailImg}}".

@frederico​galvao -

@@ mhartington :- Now image is start displaying. I am trying last two days. Thanks a lot … :slight_smile: :slight_smile:

One more query for you. How to download file(pdf/image/ppt) from server?
I am trying from last week. :frowning: if you have any solution please post the code…

Hmm, not too sure about that. But it sounds like you need to have access the devices file system, so check our cordova’s file system plugin.

@mhartington- I used plugin. Now file is downloading but where it is downloading in windows phone 8 . I am not able to find.Because, i want to open that file. After success full download. Can you help me?

Hi guys, I have the same issue (on Android and iOS) and I can’t find a way to fix it.

If I use this code:

<a ng-repeat="category in rows">
  <img ng-src="img/{{category.title}}.png">

Images are not displayed on the device, but if I hard-code the image name like

<a ng-repeat="category in rows">
  <img ng-src="img/paper.png">

it will display correctly.

Needless to say, I have already tried mharington’s solution

.config(function ($stateProvider, $urlRouterProvider, $compileProvider) {

with no success.

The issue is happening only on devices, it’s all good on browsers and simulators. Any idea?

Hi @igghera,

Above code is working in Android and windows both for me.

Try replace

May be there is some other issue.
Can you create codepen ?

1 Like

Hi @shashikant,

thanks for your reply. I will create a codepen as soon as I get home.

I have tried your option but it didn’t work :frowning:

The real problem is I don’t know how to debug it! I mean, I run

ionic run android

and look at my phone, but I have no debugging tools to see what the error is. How do you debug your apps?

1)Check in Firebug. If there is any error in browser(Except NetworkError: 404 Not Found cordova.js".)
2)Using alert().

When I test it on the browser (and simulator) there is not error (apart from cordova.js not found).
Re: alert, it’s not so useful in this case, is it? I wish I could debug it with an IDE or something similar :frowning: