Skip to content

Instantly share code, notes, and snippets.

@NathanWalker
Created June 30, 2022 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NathanWalker/e2cb712514e81b984a8381400e27437f to your computer and use it in GitHub Desktop.
Save NathanWalker/e2cb712514e81b984a8381400e27437f to your computer and use it in GitHub Desktop.
Angular Directive Sample
import { Directive, ElementRef, inject } from "@angular/core";
@Directive({
selector: "[appHighlight]",
})
export class HighlightDirective {
private el = inject(ElementRef);
constructor() {
this.el.nativeElement.style.backgroundColor = "yellow";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment