Reputation: 2917
So I am using a custom directive that loads a secondary image source if the first image source resolves to a 404 using this directive.
.directive('errSrc', function() {
return {
link: function(scope, element, attrs) {
element.bind('error', function() {
if (attrs.src != attrs.errSrc) {
attrs.$set('src', attrs.errSrc);
}
});
}
}
This works great, and if a ng-src="" resolves to 404 then it loads the err-src="" that is on that image and replaces it. However is there a way to suppress the 404 message generated in console? The function works fine but it is really hard to debug when you see 404 image missing 100 times in a row.
Upvotes: 2
Views: 993
Reputation: 2917
Pankaj Pakar pretty much answered it, after much googling it seems that this is not possible currently. Closing.
Upvotes: 2