Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

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

Description

@Femina

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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions