1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-24 20:23:24 +00:00
Files
browser/src/app/directives/fallback-src.directive.ts
Kyle Spearrin f2923d9c81 lint fixes
2018-01-24 09:26:59 -05:00

21 lines
387 B
TypeScript

import {
Directive,
ElementRef,
HostListener,
Input,
} from '@angular/core';
@Directive({
selector: '[appFallbackSrc]',
})
export class FallbackSrcDirective {
@Input('appFallbackSrc') appFallbackSrc: string;
constructor(private el: ElementRef) {
}
@HostListener('error') onError() {
this.el.nativeElement.src = this.appFallbackSrc;
}
}