From 6206d99b8658baac9faef023a8d9d1520b059a4e Mon Sep 17 00:00:00 2001 From: Benjamin Blackwood <7598058+BBlackwo@users.noreply.github.com> Date: Fri, 26 Feb 2021 17:27:56 +1100 Subject: [PATCH] docs(forms): add array example to get method (#41008) PR Close #41008 --- packages/forms/src/model.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/forms/src/model.ts b/packages/forms/src/model.ts index f7b75fda46..ae6550a82b 100644 --- a/packages/forms/src/model.ts +++ b/packages/forms/src/model.ts @@ -830,6 +830,17 @@ export abstract class AbstractControl { * -OR- * * * `this.form.get(['person', 'name']);` + * + * ### Retrieve a control in a FormArray + * + * When accessing an element inside a FormArray, you can use an element index. + * For example, to get a `price` control from the first element in an `items` array you can use: + * + * * `this.form.get('items.0.price');` + * + * -OR- + * + * * `this.form.get(['items', 0, 'price']);` */ get(path: Array|string): AbstractControl|null { return _find(this, path, '.');