I just started using Angular 2 and was wondering why some properties like selector
and template
are put in components decorators and not in components classes.
What's the point of using all these decorators in Angular 2?
To make it easy for tools to provide all kinds of support in templates like:
To generate code from decorators which allows:
Code would need to be executed to use results expressions might emit. Decorators can be easily evaluated statically without executing the TypeScript code (except maybe a simple and limited subset).