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

Method constructor

packages/forms/src/model/form_group.ts:209–227  ·  view source on GitHub ↗

* Creates a new `FormGroup` instance. * * @param controls A collection of child controls. The key for each child is the name * under which it is registered. * * @param validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions`

(
    controls: TControl,
    validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null,
    asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null,
  )

Source from the content-addressed store, hash-verified

207 *
208 */
209 constructor(
210 controls: TControl,
211 validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null,
212 asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null,
213 ) {
214 super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
215 (typeof ngDevMode === 'undefined' || ngDevMode) && validateFormGroupControls(controls);
216 this.controls = controls;
217 this._initObservables();
218 this._setUpdateStrategy(validatorOrOpts);
219 this._setUpControls();
220 this.updateValueAndValidity({
221 onlySelf: true,
222 // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
223 // `VALID` or `INVALID`. The status should be broadcasted via the `statusChanges` observable,
224 // so we set `emitEvent` to `true` to allow that during the control creation process.
225 emitEvent: !!this.asyncValidator,
226 });
227 }
228
229 public controls: ɵTypedOrUntyped<TControl, TControl, {[key: string]: AbstractControl<any>}>;
230

Callers

nothing calls this directly

Calls 6

_setUpControlsMethod · 0.95
pickValidatorsFunction · 0.90
pickAsyncValidatorsFunction · 0.90
_setUpdateStrategyMethod · 0.45

Tested by

no test coverage detected