Arunkumar Gudelli's profile picture
Arunkumar Gudelli
@arunGudelli
View on Twitter

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.

@threadreaderapp unroll

Help us raise more money for charities by sharing this page ♥️
Wait! Before you go...
Grab Exclusive Deals for Books, Courses, Software.
100% of Profits Are Donated To Research-Backed Charities.