fixed directive outputs with the correct sample
錯誤的範例更正,參照英文版。
This commit is contained in:
parent
e8c76a6f8d
commit
681d12cf3d
@ -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;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user