A New Method for Retrieving Metadata about Angular Components

Netanel Basal
Netanel Basal
Published in
Jul 28, 2022

A new function named reflectComponentType() has been added to Angular v14.1.0 that returns the following metadata from a component:

This function has several uncommon uses. It can be used to create debugging tools or, for example, we can use the selector metadata to create custom elements based on existing components:

We can use it to create dynamic components based on a JSON file. The following thread contains additional use cases:

Follow me on Medium or Twitter to read more about Angular and JS!

--

--

Netanel Basal
Netanel Basal

Written by Netanel Basal

A FrontEnd Tech Lead, blogger, and open source maintainer. The founder of ngneat, husband and father.

Responses (1)