Explain Decorators in Angular?

An Angular Decorator is a function, using which we attach metadata to a class, method, accessor, property, or parameter.
We apply the decorator using the form @expression, where expression is the name of the decorator.

The Decorators are Typescript features and are still not part of the Javascript.

Angular Decorators List:

@NgModule @Component @Injectable @Directive

@Pipe @Input @Output @Host

@HostBinding @HostListener @ContentChild @ContentChildren @ViewChild @ViewChildren @Inject @Self

@SkipSelf @Optional

We can classify decorators under four different categories

Class decorators: We apply class decorators to classes.

Property Decorators: Property Decorators are applied to the properties of the class.

Method Decorators: Method Decorators are applied to the methods of the class.

Parameter Decorators: Parameter Decorators are applied to the constructor parameter of the class.