Directives

Use directives to enhance an element (Style 06-01)

  • Use attribute directives when you have presentation logic without a template.

@Directive({
  selector: '[tohHighlight]'
})
export class HighlightDirective {
  @HostListener('mouseover') onMouseEnter() {
    // do highlight work
  }
}
<div tohHighlight>Bombasta</div>