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.
angularjswiki.com/angular/direct…
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.