import {Component, EventEmitter, Input, Output} from 'angular2/core';
// #docregion
@Component({
selector: 'my-confirm',
template: `
`
})
export class ConfirmComponent {
@Input() okMsg:string;
@Input('cancelMsg') notOkMsg:string;
@Output() ok =
new EventEmitter();
@Output('cancel') notOk =
new EventEmitter();
onOkClick() {
this.ok.next(true);
}
onNotOkClick() {
this.notOk.next(true);
}
}
// #enddocregion
@Component({
selector: 'hero-io',
template: `
OK clicked
Cancel clicked
`,
directives: [ConfirmComponent]
})
export class AppComponent {
okClicked:boolean;
cancelClicked:boolean;
onOk() {
this.okClicked = true;
}
onCancel() {
this.cancelClicked = true;
}
}