docs(core): update code sample for "outputs" attribute (#31199)

The current code sample for (directive) "outputs" attribute is incorrect as it does not provide the usage of "outputs" attribute rather it provides the usage of "exportAs" attribute. This commit update the code sample by correcting the code sample with correct usage of "outputs" attribute.

Fixes https://github.com/angular/angular/issues/29523
Related work https://github.com/angular/angular/pull/30014

This commit continues from the unfinished (https://github.com/angular/angular/pull/30014#issuecomment-485419124, https://github.com/angular/angular/issues/29523#issuecomment-497333146) work.

PR Close #31199
This commit is contained in:
Umair Sarfraz 2019-06-22 00:49:11 +05:00 committed by Kara Erickson
parent 280e8563f0
commit ae1ac45981
1 changed files with 10 additions and 3 deletions

View File

@ -163,18 +163,25 @@ export interface Directive {
* ### Example
*
* ```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;
* }
* }
* ```
*