It makes sense to discuss decorators now because they are heavily used by Angular.
We will only scratch the surface here, as decorators are fairly advanced and, most of the time, you'll be using them rather than writing your own.
It makes sense to discuss decorators now because they are heavily used by Angular.
We will only scratch the surface here, as decorators are fairly advanced and, most of the time, you'll be using them rather than writing your own.
Decorators provide a way to do metaprogramming and attach metadata to classes and class members (that is, methods, accessors, fields, and parameters). They're sometimes referred to as annotations, but they are more than that (in TypeScript at least).
Annotations provide a way to attach metadata to annotated elements. While decorators can do the same, they can also expand and/or modify the behavior of the elements they're applied...