@compodoc/compodoc
Version:
The missing documentation tool for your Angular application
28 lines (21 loc) • 629 B
text/typescript
import { Directive, ElementRef, HostListener, Input, OnInit } from '@angular/core';
({
selector: '[appBorder]',
standalone: true,
})
export class BorderDirective implements OnInit {
() color: string = 'red';
constructor(private el: ElementRef) {}
ngOnInit() {
this.border('');
}
('mouseenter') onMouseEnter() {
this.border(this.color);
}
('mouseleave') onMouseLeave() {
this.border('');
}
private border(color: string) {
this.el.nativeElement.style.border = `2px solid ${color || 'transparent'}`;
}
}