Marks a class as an Angular component and collects component configuration metadata.
.
@Component({selector: 'greet', template: 'Hello {{name}}!'}) class Greet { name: string = 'World'; }
Component decorator allows you to mark a class as an Angular component and provide additional metadata that determines how the component should be processed, instantiated and used at runtime.
Components are the most basic building block of an UI in an Angular application. An Angular application is a tree of Angular components. Angular components are a subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template.
A component must belong to an NgModule in order for it to be usable by another component or application. To specify that a component is a member of an NgModule, you should list it in the declarations
field of that NgModule.
In addition to the metadata configuration specified via the Component decorator, components can control their runtime behavior by implementing various Life-Cycle hooks.
Metadata Properties:
@Component({selector: 'greet', template: 'Hello {{name}}!'}) class Greet { name: string = 'World'; }
exported from @angular/core/index defined in @angular/core/src/metadata/directives.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/index/Component-decorator.html