I am trying to display images in a list. The path to the image is stored in an array called imagesUrls.
imagesUrls['dhd.png'] = "./img/brands/dhd.png"
imagesUrls['channelislands.png'] = "./img/brands/channelislands.png"
etc...
<ion-item collection-repeat="item in prodataSelect | unique:'brand' | orderBy:'brand'" collection-item-height="75" >
<img class="selectBrandImage" ng-src="imagesUrls['{{item.brand | nospace | lowercase}}.png']" />
<span classs="selectBrandName">{{item.brand}}</span>
</ion-item>
controllers.js:
prodata = sessionService.get('prodata');
$scope.prodataSelect = prodata;
$scope.imagesUrls = sessionService.get('imagesUrls');
I can't find the right syntax for the ng-src in the template, can you help please ?
I also tried this:
ng-src="getImgPath(item.brand)"
with this:
$scope.getImgPath = function(str) {
return imagesUrls[$filter('nospace')($filter('lowercase')(str))];
}
prodataobject? By order?