0

I am working on an Ionic project and via json I was able to readout my data in the view. But for some reason my image won't come through.

Here is a screenshot of my console:

enter image description here

As you can see from the picture the data is coming in correctly.

My html code:

  <ion-list>
      <div ng-repeat="newsItem in newsItems">
        <a href="#">
            <img ng-src="{{newsItem.picture}}" width="80" height="80">
            <p>{{newsItem.name}}</p>
        </a>        
      </div>
  </ion-list>

Anyone has an idea why the image is not showing?

1
  • can you make a plunker ?? Commented Nov 11, 2015 at 7:32

2 Answers 2

1

ok, first you jsfiddle is broken ! but no biggie, just remove ';' from the first line. Second your json news doesn't have a pictures it's just this ...

{"newsID":"58","name":"Chemicar presentation","idk":"new","kind":"news","picture":"58.jpg","picture1":"","start_time":"1446073201"}

You are binding to {{newsItem.picture}} and as you can see your picture it's there as a 58.jpg but this is not a picture it's just a string of picture name, so that's why it's not showing anything in the html!

Sign up to request clarification or add additional context in comments.

5 Comments

ok thanks, so i guess there is no way to show it with the json?
it is if your json contain a valid base64 picture
mmm, ok i will look into it because i dont know if the json is base64 (external json). thanks anyway
mmm i tried something like this: <img class="thumbnailNews" ng-src="data:picture/JPEG;base64,{{newsItem.picture}}" width="80" height="80"> but i am getting an error -> net::ERR_UNKNOWN_URL_SCHEME
and make sure that your {{newsItem.picture}} it's something more then a string like '58.jpg'
0

(Perhaps I should have put this in a comment; totally going to get flamed)

I wonder if it could be a z-index issue?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.