1.

What is the difference between annotation and decorator?

Answer»

Annotation and decorator both have SYMBOL @ but STILL, they have some different language features-

 AnnotationDecorator
1.These are metadata set on the class using the Reflect Metadata Library.Decorator correlates to a FUNCTION that is called on the class.
2.It is used by the Traceur compiler.It is used by the TYPESCRIPT compiler.
3.Annotations are hardcoded.Decorators are not hardcoded.
4.Annotation Imports: import {ComponentAnnotation as Component} from ‘@angular/core’;Decorator Imports: import {Component} from ‘@angular/core’;


Discussion

No Comment Found