* Retrieves a child control given the control's name or path. * * @param path A dot-delimited string or array of string/number values that define the path to the * control. If a string is provided, passing it as a string literal will result in improved type * information. Likewise, if an
(
path: P,
)
| 1592 | * * `this.form.get(['items', 0, 'price']);` |
| 1593 | */ |
| 1594 | get<P extends string | (string | number)[]>( |
| 1595 | path: P, |
| 1596 | ): AbstractControl<ɵGetProperty<TRawValue, P>> | null { |
| 1597 | let currPath: Array<string | number> | string = path; |
| 1598 | if (currPath == null) return null; |
| 1599 | if (!Array.isArray(currPath)) currPath = currPath.split('.'); |
| 1600 | if (currPath.length === 0) return null; |
| 1601 | return currPath.reduce( |
| 1602 | (control: AbstractControl | null, name) => control && control._find(name), |
| 1603 | this, |
| 1604 | ); |
| 1605 | } |
| 1606 | |
| 1607 | /** |
| 1608 | * @description |