docs(forms): add array example to get method (#41008)

PR Close #41008
This commit is contained in:
Benjamin Blackwood 2021-02-26 17:27:56 +11:00 committed by Zach Arend
parent 6c05c80f19
commit 6206d99b86
1 changed files with 11 additions and 0 deletions

View File

@ -830,6 +830,17 @@ export abstract class AbstractControl {
* -OR- * -OR-
* *
* * `this.form.get(['person', 'name']);` * * `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|number>|string): AbstractControl|null { get(path: Array<string|number>|string): AbstractControl|null {
return _find(this, path, '.'); return _find(this, path, '.');