mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-10 21:03:56 +08:00
15 lines
351 B
TypeScript
15 lines
351 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;
|
|
}
|
|
}
|