MCPcopy Index your code
hub / github.com/angular/angular / get

Function get

packages/forms/src/model/abstract_model.ts:1571–1582  ·  view source on GitHub ↗

* 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,
  )

Source from the content-addressed store, hash-verified

1569 * * `this.form.get(['items', 0, 'price']);`
1570 */
1571 get<P extends string | (string | number)[]>(
1572 path: P,
1573 ): AbstractControl<ɵGetProperty<TRawValue, P>> | null {
1574 let currPath: Array<string | number> | string = path;
1575 if (currPath == null) return null;
1576 if (!Array.isArray(currPath)) currPath = currPath.split('.');
1577 if (currPath.length === 0) return null;
1578 return currPath.reduce(
1579 (control: AbstractControl | null, name) => control && control._find(name),
1580 this,
1581 );
1582 }
1583
1584 /**
1585 * @description

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
reduceMethod · 0.80
_findMethod · 0.45

Tested by

no test coverage detected