InputMetadata

export class InputMetadata

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

Declares a data-bound input property.

Angular automatically updates data-bound properties during change detection.

InputMetadata takes an optional parameter that specifies the name used when instantiating a component in the template. When not provided, the name of the decorated property is used.

Example

The following example creates a component with two input properties.

  1. @Component({
  2. selector: 'bank-account',
  3. template: `
  4. Bank Name: {{bankName}}
  5. Account Id: {{id}}
  6. `
  7. })
  8. class BankAccount {
  9. @Input() bankName: string;
  10. @Input('account-id') id: string;
  11. // this property is not bound, and won't be automatically updated by Angular
  12. normalizedBankName: string;
  13. }
  14. @Component({
  15. selector: 'app',
  16. template: `
  17. <bank-account bank-name="RBC" account-id="4747"></bank-account>
  18. `,
  19. directives: [BankAccount]
  20. })
  21. class App {}
  22. bootstrap(App);

Constructor

constructor(bindingPropertyName?: string)

Not Yet Documented

Members

bindingPropertyName : string

Name used when instantiating a component in the temlate.