2018-02-10 15:18:01 +00:00
|
|
|
import ngModule from '../module';
|
2018-01-25 12:37:27 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2018-02-10 15:18:01 +00:00
|
|
|
ngModule.directive('onErrorSrc', onErrorSrc);
|