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

Method constructor

packages/forms/src/model/form_array.ts:139–157  ·  view source on GitHub ↗

* Creates a new `FormArray` instance. * * @param controls An array of child controls. Each child control is given an index * where it is registered. * * @param validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object t

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

Source from the content-addressed store, hash-verified

137 *
138 */
139 constructor(
140 controls: Array<TControl>,
141 validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null,
142 asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null,
143 ) {
144 super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
145 this.controls = controls;
146 this._initObservables();
147 this._setUpdateStrategy(validatorOrOpts);
148 this._setUpControls();
149 this.updateValueAndValidity({
150 onlySelf: true,
151 // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
152 // `VALID` or `INVALID`.
153 // The status should be broadcasted via the `statusChanges` observable, so we set `emitEvent`
154 // to `true` to allow that during the control creation process.
155 emitEvent: !!this.asyncValidator,
156 });
157 }
158
159 public controls: ɵTypedOrUntyped<TControl, Array<TControl>, Array<AbstractControl<any>>>;
160

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected