问题
What is the use of the decorators in angular2 ? What does it do? like to annotate and modify classes and properties at design time. This sounds pretty much like what annotations do right? Could you explain this ? Thanks in advance.
回答1:
It provides meta information for components, directives, pipes, and for dependency injection.
They can be used by tools for linting and auto-completion and other design tools.
Build tools will generate code (or HTML/CSS) from them.
See also How are decorators (annotations) compiled in Typescript?
来源:https://stackoverflow.com/questions/35431346/what-does-decorators-in-angular2-do-in-components