MCPcopy Create free account
hub / github.com/angular/angular / get

Function get

packages/forms/src/model/abstract_model.ts:1594–1605  ·  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

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

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
reduceMethod · 0.80
_findMethod · 0.45

Tested by

no test coverage detected