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

Method setValue

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

* Sets the value of the `FormArray`. It accepts an array that matches * the structure of the control. * * This method performs strict checks, and throws an error if you try * to set the value of a control that doesn't exist or if you exclude the * value of a control. * * @usageN

(
    value: ɵFormArrayRawValue<TControl>,
    options: {
      onlySelf?: boolean;
      emitEvent?: boolean;
    } = {},
  )

Source from the content-addressed store, hash-verified

316 * updateValueAndValidity} method.
317 */
318 override setValue(
319 value: ɵFormArrayRawValue<TControl>,
320 options: {
321 onlySelf?: boolean;
322 emitEvent?: boolean;
323 } = {},
324 ): void {
325 untracked(() => {
326 assertAllValuesPresent(this, false, value);
327 value.forEach((newValue: any, index: number) => {
328 assertControlPresent(this, false, index);
329 this.at(index).setValue(newValue, {onlySelf: true, emitEvent: options.emitEvent});
330 });
331 this.updateValueAndValidity(options);
332 });
333 }
334
335 /**
336 * Patches the value of the `FormArray`. It accepts an array that matches the

Callers

nothing calls this directly

Calls 7

atMethod · 0.95
untrackedFunction · 0.90
assertAllValuesPresentFunction · 0.90
assertControlPresentFunction · 0.90
setValueMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected