【发布时间】:2015-03-18 09:49:42
【问题描述】:
我想根据值显示图像,所以我尝试为它应用一些过滤器,但无法弄清楚为什么它不起作用。它只是显示一个没有图像的列。不知道出了什么问题,为什么它没有正确匹配。请帮帮我。在此先感谢。任何帮助将不胜感激。
我的过滤器看起来像
app .filter('imagefilter', function() {
return function(SA) {
if('SA'===0) return 'http://goo.gl/aFomAA';
if('SA'===1) return 'http://goo.gl/vxCnLC';
if('SA'===2) return 'http://goo.gl/aFomAA';
//other mappings
}
});
单元格模板看起来像
{
field: "SA",
sortable:true,
displayName:"Service Affecting",
cellTemplate:'<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text><img class="flag" ng-src="{{row.getProperty(\'SA\') | imagefilter}}"</img></span></div>',
width: '80px'
}
【问题讨论】: