This suggestion will not work for me, because I created my links to images based on the role of users. The user had a role, but that did not mean that they had an image associated with it.
So, I created a directive:
angular.module('hideEmptyImages', []) .directive('hideEmptyImage',function() { return { Restrict: 'AE', Link: function (scope, elem, attrs) { elem.error(function() { elem.hide(); }); } }; });
So:
<img hide-empty-image width="50px" src="/resources/img/products/{{current.manufacturerImage.imagePath}}">
will not be displayed if .imagePath is empty or if there is simply no linked image.
Tj gienger
source share