fixed directive outputs with the correct sample

錯誤的範例更正,參照英文版。
This commit is contained in:
HaoLi 2019-12-26 14:52:47 +08:00 committed by 雪狼
parent e8c76a6f8d
commit 681d12cf3d

View File

@ -237,18 +237,27 @@ export interface Directive {
* ###
*
* ```typescript
* @Directive({
* @Component({
* selector: 'child-dir',
* exportAs: 'child'
* outputs: [ 'bankNameChange' ]
* template: `<input (input)="bankNameChange.emit($event.target.value)" />`
* })
* class ChildDir {
* bankNameChange: EventEmitter<string> = new EventEmitter<string>();
* }
*
* @Component({
* selector: 'main',
* template: `<child-dir #c="child"></child-dir>`
* template: `
* {{ bankName }} <child-dir (bankNameChange)="onBankNameChange($event)"></child-dir>
* `
* })
* class MainComponent {
* bankName: string;
*
* onBankNameChange(bankName: string) {
* this.bankName = bankName;
* }
* }
* ```
*