OutputMetadata

export class OutputMetadata

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

Declares an event-bound output property.

When an output property emits an event, an event handler attached to that event the template is invoked.

OutputMetadata 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

@Directive({ selector: 'interval-dir', }) class IntervalDir { @Output() everySecond = new EventEmitter(); @Output('everyFiveSeconds') five5Secs = new EventEmitter(); constructor() { setInterval(() => this.everySecond.emit("event"), 1000); setInterval(() => this.five5Secs.emit("event"), 5000); } } @Component({ selector: 'app', template: ` <interval-dir (every-second)="everySecond()" (every-five-seconds)="everyFiveSeconds()"> </interval-dir> `, directives: [IntervalDir] }) class App { everySecond() { console.log('second'); } everyFiveSeconds() { console.log('five seconds'); } } bootstrap(App);

Constructor

constructor(bindingPropertyName?: string)

Not Yet Documented

Members

bindingPropertyName : string

Not Yet Documented