->Decorators are a feature of
TypeScript and are implemented as functions.
The name of the
decorator starts with @symbol following by brackets and arguments,since
decorators are just functions in TypeScript .
->Decorators are simply
functions that return functions. These functions supply metadata to Angular
about a particular class, property, value, or method.
->Decorators are invoked
at runtime.
->Decorators allow you to
executes functions. For example @Component executes the Component function imported
from Angular7
Some Common Decorators
@NgModule() to define modules.
@Component() to define components.
@Injectable() to define services.
@Input() and @Output() to define properties ..that send and
receive data from the dome.
There are many built-in decorators available in Angular and
many properties on each decorator.
Types Of Decorators
->Class decorators. e.g. @Component and @NgModule
->Property decorators for properties inside classes,
e.g. @Input and @Output
->Method decorators for methods inside classes, e.g
@HostListener
->Parameter decorators for parameters inside class
constructors e.g. @Inject
Each decorator has a unique role.
No comments:
Post a Comment