Decorators are custom modifiers that are applied to classes, methods, properties, computed properties, and method parameters. Each decorator consists of an @ symbol, followed by a TypeScript expression, which evaluates to a function. Decorators can add metadata to classes, can modify class behavior, and can specify the role of a class in a client framework. They play a fundamental role in the Angular framework, described in the final part of this book, that uses them to specify the roles of special classes in the framework (components, modules, directives, and so on), to constrain the roles of some class properties (input or output), to assign special roles to certain methods (such as the event handler role), and to specify that some parameters must be injected automatically in a method call with a technique called dependency injection (@Inject).
The following...