Component: ComponentFactory

export Component : ComponentFactory

exported from angular2/core defined in angular2/src/core/metadata.ts (line 507)

Declare reusable UI building blocks for an application.

Each Angular component requires a single @Component and at least one @View annotation. The @Component annotation specifies when a component is instantiated, and which properties and hostListeners it binds to.

When a component is instantiated, Angular

All template expressions and statements are then evaluated against the component instance.

For details on the @View annotation, see ViewMetadata.

Lifecycle hooks

When the component class implements some lifecycle_hooks the callbacks are called by the change detection at defined points in time during the life of the component.

Example

@Component({selector: 'greet', template: 'Hello {{name}}!', directives: [CustomDirective]}) class Greet { name: string = 'World'; }