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