图片不显示,虽然数据回来从成功的http请求(离子) [英] Image not showing, although data coming successful back from http request (Ionic)
问题描述
我的工作离子项目,并通过JSON我能够读出在视图中我的数据。但由于某些原因,我的形象会不会来通过。
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:
你可以从数据被正确即将在图片中看到。
As you can see from the picture the data is coming in correctly.
我的HTML code:
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?
推荐答案
好吧,首先你的jsfiddle坏了!但根本不算什么,只是删除;从第一行。其次你的JSON消息没有一个图片,它只是这个...
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,名:Chemicar $p$psentation\",\"idk\":\"new\",\"kind\":\"news\",\"picture\":\"58.jpg\",\"picture1\":\"\",\"start_time\":\"1446073201\"}$c$c>
您绑定到 {{} newsItem.picture}
和你可以看到你的照片它的存在为 58.jpg 但这是不是一个图片,它只是一个图片名称的字符串,所以这就是为什么它没有出现在HTML的东西!
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!
这篇关于图片不显示,虽然数据回来从成功的http请求(离子)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!