Understanding directive composition API in Angular 15 @angular #angular #angular15 #typescript #javascript
It’s one of the most requested feature from the Angular community since 2016. (From Angular 2 onwards)
(1/n)
Create a stand alone directive and add some functionality like css style

Add it in the component declaration using
hostDirectives property

Now no need to add directive to the component tag

We can muliplte standalone directives inside a component

We can use "hostDirectives" inside a directive as well

And use the directive('appStyle') on any element

We can chain the multiple directives

Let me know your thoughts on this new Directive composition API.
Thanks for reading.
Follow me for more Angular related tips.
Here is the complete Tutorial.
https://www.angularjswiki.com/angular/directive-composition-api-in-angular-15/
@threadreaderapp unroll