Adding functionality to existing components by extending them and not creating a complete custom component?

42 views
Skip to first unread message

nikolai esla

unread,
Mar 21, 2024, 5:19:31 AMMar 21
to angular-material2
The guides and examples are all about creating a custom component, which as the website demonstrates makes sense for slightly more complex components. e.g. The phone number input with 3 sections. However, for simply adding minimal extra functionality, this seems to be an overkill.
Here is an example...
If I want to make a generic, reusable mat-autocomplete, which gathers objects from an API (Service) and displays them, all I should do is to extend the mat-autocomplete. Reason is that it already implements all that MatFormField interface. However, as a beginner I do not see any example/guide out there for this scenario.
I wonder, if there is a design principle discourages from this?
Reply all
Reply to author
Forward
0 new messages