图片没有显示在ng-repeat中,从indexeddb获取所有数据并绑定到页面所有内容都显示在blackberry 10 webworks中的img
<img data-ng-src='{{item.Picture}}' width="100px;" height="100px;"/>
{
id:48758,
Botanical_name:"Cladothamnus pyroliflorus",
Common_name:"Himalayan Cotoneaster ",
Picture: "images/Fplants/Cladothamnus pyroliflorus.png",
},...
答案 0 :(得分:0)
这似乎不是IndexedDB的问题。
对于非Angular指令属性,例如src
,您希望按以下代码进行插值:
<img src='{{item.Picture}}' width="100px;" height="100px;"/>
对于Angular指令属性,不需要这样的插值:
<img data-ng-src='item.Picture' width="100px;" height="100px;"/>
由于您的数据将在引导程序中为undefined
,因此您希望使用后一种方法。它会阻止浏览器尝试加载undefined
作为图像源。
另外,请注意vaibhav上面的评论。如果没有前导斜杠,您将加载images
目录作为相对于当前的目录。虽然这可能是你想要的,但它可能会使你的代码更加可重用,无论如何都包含前导斜杠。
更新:如果您在ng-repeat
,请注意您的范围不是ng-repeat
指令出现的范围,而是它自己的全新范围。也许试试$parent.item.Picture
答案 1 :(得分:0)
我有同样的问题,它出现在图像文件名之间有空格,也许我们可以写一个指令从文件名中删除空格,因为我通过其他变量调用图像作为标题..
答案 2 :(得分:0)
app.config(['$routeProvider','$compileProvider',function($routeProvider, $compileProvider){ $compileProvider.imgSrcSanitizationWhitelist('img/');