Skip to content
masterclass Buddy

Angular · Decorator

Directive

The @Directive decorator marks a class as an Angular directive. Its metadata tells Angular where to create the directive and how to connect inputs, outputs, providers, queries, and host bindings.

Last updated

Syntax

@Directive({ selector?: string; inputs?: (string | { name: string; alias?: string; required?: boolean; transform?: (value: any) => any; })[]; outputs?: string[]; providers?: Provider[]; exportAs?: string; queries?: { [key: string]: any }; host?: { [key: string]: string }; jit?: true; standalone?: boolean; hostDirectives?: (Type<unknown> | { directive: Type<unknown>; inputs?: string[]; outputs?: string[]; })[]; })

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Component
  • HostBinding
  • HostListener
  • Input
  • Output
  • NgModule

Source: Directive • Angular. Checked 2026-11-03.