18 lines
442 B
JavaScript
18 lines
442 B
JavaScript
|
import {module} from '../module';
|
||
|
|
||
|
function onErrorSrc() {
|
||
|
return {
|
||
|
restrict: 'A',
|
||
|
link: (scope, element, attrs) => {
|
||
|
let imgError = '/static/images/no-image200x200.png';
|
||
|
element.bind('error', function() {
|
||
|
if (attrs.src != imgError) {
|
||
|
attrs.$set('src', imgError);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.directive('onErrorSrc', onErrorSrc);
|