From 3ddb41607384f65fd658f039a655d71bfcb7a798 Mon Sep 17 00:00:00 2001 From: "Kevin C. Coram" Date: Tue, 31 Dec 2019 14:49:50 -0800 Subject: [PATCH] Improve component typesript example --- apps/baseline/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/baseline/README.md b/apps/baseline/README.md index 31cf8f7..5e05a5c 100644 --- a/apps/baseline/README.md +++ b/apps/baseline/README.md @@ -3,6 +3,11 @@ The easiest way to create a simple Reactive Form is to use a single Angular component to build and display the form. In this example application, an asynchronous call to an API is simulated. The `Contact` object thus obtained is used to create and initialize a `FormGroup` using the Angular `FormBuilder`. ```typescript +export class AppComponent implements OnInit, OnDestroy { + form: FormGroup; + + private subscription: Subscription; + public ngOnInit() { this.subscription = this.service .loadContact() @@ -47,6 +52,7 @@ The easiest way to create a simple Reactive Form is to use a single Angular comp get addresses(): FormArray { return this.form.get('addresses') as FormArray; } +} ``` The component's template remders input controls for the Contact's name, and iterates over the array of addresses to render controls to edit each one.