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

Method setControl

packages/forms/src/model/form_group.ts:362–375  ·  view source on GitHub ↗
(
    name: K,
    control: TControl[K],
    options: {
      emitEvent?: boolean;
    } = {},
  )

Source from the content-addressed store, hash-verified

360 ): void;
361
362 setControl<K extends string & keyof TControl>(
363 name: K,
364 control: TControl[K],
365 options: {
366 emitEvent?: boolean;
367 } = {},
368 ): void {
369 const existingControl = this._find(name as string);
370 if (existingControl) existingControl._registerOnCollectionChange(() => {});
371 delete this.controls[name];
372 if (control) this.registerControl(name, control);
373 this.updateValueAndValidity({emitEvent: options.emitEvent});
374 this._onCollectionChange();
375 }
376
377 /**
378 * Check whether there is an enabled control with the given name in the group.

Callers

nothing calls this directly

Calls 3

_findMethod · 0.95
registerControlMethod · 0.95

Tested by

no test coverage detected