From the course: Creating Angular Libraries

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Directive composition

Directive composition

- [Derek] Directive composition lets you combine simple directives into more complex behaviors. You do this using the host directives array on the directive decorator. Array values can be directive classes or configuration objects. Directives you pass into this array are called "host directives." You apply one or more of these host directives to a host class. host directives have the same lifecycle as any other component or directive. They always execute their lifecycles before the host does. But if you have more than one host directive on a host, the exact order of execution is not guaranteed. By default, host directives hide their inputs and outputs from the host. You must expose inputs and outputs manually as part of the configuration object for that directive. Let's see what all this looks like in the code. I opened our project here in a GitHub code space. I talk about why we use code spaces earlier in this course. So for now, just think of them as an easy way to share and write…

Contents