angular-picturefill icon indicating copy to clipboard operation
angular-picturefill copied to clipboard

picturefill directive to load default image onerror or handle of broken images

Open Femina opened this issue 9 years ago • 1 comments

I attempted to create a directive which can handle default image in the case of pf-src has broken image case. I couldn't make it... shall we have that directive as built in ? if already available how to implement it ?

Ex: myApp.directive('onErrorSrc', function() { return { link: function(scope, element, attrs) { element.bind('error', function() { if (attrs.src != attrs.onErrorSrc) { attrs.$set('src', attrs.onErrorSrc); } }); } } });

img ng-src="wrongUrl.png" on-error-src="http://google.com/favicon.ico"

Femina avatar May 25 '16 13:05 Femina

Thanks for the feedback! That feature is not currently implemented. I'll leave this issue open because I think it's a great suggestion. Would love to find the time to get to it. Thanks!

tinacious avatar Jun 14 '16 11:06 tinacious