From ae1ac45981740700a1e1d6fcf0fbb44242843a3b Mon Sep 17 00:00:00 2001 From: Umair Sarfraz Date: Sat, 22 Jun 2019 00:49:11 +0500 Subject: [PATCH] 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 --- packages/core/src/metadata/directives.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/core/src/metadata/directives.ts b/packages/core/src/metadata/directives.ts index b060115d71..ef6e0010b0 100644 --- a/packages/core/src/metadata/directives.ts +++ b/packages/core/src/metadata/directives.ts @@ -163,18 +163,25 @@ export interface Directive { * ### Example * * ```typescript - * @Directive({ + * @Component({ * selector: 'child-dir', - * exportAs: 'child' + * outputs: [ 'bankNameChange' ] + * template: `` * }) * class ChildDir { + * bankNameChange: EventEmitter = new EventEmitter(); * } * * @Component({ * selector: 'main', - * template: `` + * template: ` {{ bankName }} ` * }) * class MainComponent { + * bankName: string; + * + * onBankNameChange(bankName: string) { + * this.bankName = bankName; + * } * } * ``` *