0Pricing
Angular Academy · Lesson

The hostDirectives Property

Attach directives to a component host.

Directive Composition API

The Directive Composition API lets a component or directive apply other directives to its own host element declaratively, via the hostDirectives property. This enables reuse without inheritance.

The Problem It Solves

Previously, to reuse directive behavior you either repeated the directive in every template or used inheritance. hostDirectives composes behaviors directly onto a host.

All lessons in this course

  1. The hostDirectives Property
  2. Exposing Inputs and Outputs
  3. Building Reusable Behaviors
  4. Composition vs Inheritance
← Back to Angular Academy