These are hard-coded language features. Annotations are just class-set metadata reflecting the metadata library. 

The compiler adds an annotations property to the class, stores an annotation array in it, and then tries to instantiate an object with the same name as the annotation,

Define a TypeScript class and annotate it with the @Component decorator

so delivering the metadata into the constructor, when a user annotates a class. Because they are not pre-defined, Annotations in AngularJs allow us to name them.

 

Most commonly used annotations (decorators) in Angular include

  1. @NgModule: Annotates a class to specify that it is an Angular module and provides metadata about its dependencies, components, directives, pipes, and services.
  2. @Component: Annotates a class to define an Angular component, providing metadata such as its selector, template, and style.
  3. @Directive: Annotates a class to define an Angular directive, which allows you to add behavior to elements in the DOM.
  4. @Pipe: Annotates a class to define an Angular pipe, which transforms input data to a desired output format for display.
  5. @Injectable: Annotates a class to define an injectable service


 


Related Question