Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Femina opened this issue May 25, 2016 · 1 comment

Comments

@Femina
Copy link

Femina commented May 25, 2016

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"

@tinacious
Copy link
Owner

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!

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

No branches or pull requests

2 participants