liveBook · Manning

Directive composition api

As explained in Modern Angular

The directive composition API is an Angular API for composing a component or directive from other host directives.

The Directive Composition API lets Angular components and directives automatically include other directives through the hostDirectives metadata property. section 1.4.4

Its practical significance is composability:

  • Build directives from other directives instead of relying primarily on OOP inheritance or pure dependency injection. section 1.4.4
  • Simplify component or directive code and its template by declaring composed behavior in metadata. section 1.4.4

How Modern Angular covers it

How deep it goes
Defines hostDirectives and its purpose but defers detailed implementation and application examples.
What you can do after
Apply it via Angular's hostDirectives metadata to compose directives into components or other directives.
How it connects
Connects directive composition with dependency injection, OOP inheritance, components, directives, and templates.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.