GY22
GY22

Reputation: 785

Image not showing, although data coming successful back from http request (Ionic)

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?

Upvotes: 0

Views: 263

Answers (2)

macrog
macrog

Reputation: 2105

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!

Upvotes: 1

Pytth
Pytth

Reputation: 4176

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

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

Upvotes: 0

Related Questions