您好我正在使用Onsen UI Master-Details(模板),但我怀疑: 我如何为每个元素设置图像?
按照代码:
module.factory('$data', function() {
var data = {};
data.items = [
{
title: 'Item 1 Title',
label: '4h',
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
},
{
title: 'Another Item Title',
label: '6h',
desc: 'Ut enim ad minim veniam.'
},
{
title: 'Yet Another Item Title',
label: '1day ago',
desc: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
},
{
title: 'Yet Another Item Title',
label: '1day ago',
desc: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
}
];
return data;
});
答案 0 :(得分:2)
我找到了办法!
data.items = [
{
Image: '1564940.jpg',
title: 'Item 1 Title',
label: '4h',
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
},
并且:
<div ><img class="item-thum" ng-src="images/{{item.Image}}" style="margin:auto;"></div>