Class decorator
From all the possible type of decorators we can define, class decorators are the most common ones. Class decorators allow us to enhance the functionality of the class, as TypeScript injects the logic implemented in the class decorator to the constructor of the said class. In our SNC application, as well as the applications that we will build in our remaining chapters, we use decorators, which are defined by Angular as @Component. These are class decorators and allow Angular to identify a specific class as a component and add behavior to it at runtime.
The class decorator can be defined in two ways, namely, a decorator that does not replace the constructor function and a decorator that does. This distinction happens based on ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access