Rob Wormald 3fa287aae2 refactor(EventEmitter): rename .next() to .emit()
BREAKING CHANGE:

EventEmitter#next(value) is deprecated, use EventEmitter#emit(value)
instead.

Closes #4287

Closes #5302
2015-11-18 22:16:40 +00:00

20 lines
591 B
TypeScript

import {Component, EventEmitter, Input, Output} from 'angular2/angular2';
import {ObservableWrapper} from 'angular2/src/facade/async';
@Component({selector: 'zippy', templateUrl: 'zippy.html'})
export class Zippy {
visible: boolean = true;
@Input() title: string = '';
@Output() open: EventEmitter<any> = new EventEmitter();
@Output() close: EventEmitter<any> = new EventEmitter();
toggle() {
this.visible = !this.visible;
if (this.visible) {
ObservableWrapper.callEmit(this.open, null);
} else {
ObservableWrapper.callEmit(this.close, null);
}
}
}