DEV Community

Discussion on: Wrapping Angular Material button in custom Angular component (part 1)

Collapse
 
jwp profile image
John Peters

How would we remove repetitive code? We see just one attribute changing. Any way to make it dynamic?

Collapse
 
dzhavat profile image
Dzhavat Ushev

Hej John,
Unfortunately Angular doesn't support dynamically adding of Directives. That's why the repetition is necessary. As for whether it can be removed, yes. This will be the focus in part 2.

Collapse
 
dzhavat profile image
Dzhavat Ushev

Hey John,
I've now published part 2 where remove the repetition from the template and use a more dynamic approach. Would love to hear what do you think about it :)