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

Function markAsPristine

packages/forms/src/model/abstract_model.ts:1203–1223  ·  view source on GitHub ↗
(
    opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {},
  )

Source from the content-addressed store, hash-verified

1201 sourceControl?: AbstractControl;
1202 }): void;
1203 markAsPristine(
1204 opts: {onlySelf?: boolean; emitEvent?: boolean; sourceControl?: AbstractControl} = {},
1205 ): void {
1206 const changed = this.pristine === false;
1207 this.pristine = true;
1208 this._pendingDirty = false;
1209
1210 const sourceControl = opts.sourceControl ?? this;
1211 this._forEachChild((control: AbstractControl) => {
1212 /** We don't propagate the source control downwards */
1213 control.markAsPristine({onlySelf: true, emitEvent: opts.emitEvent});
1214 });
1215
1216 if (!opts.onlySelf) {
1217 this._parent?._updatePristine(opts, sourceControl);
1218 }
1219
1220 if (changed && opts.emitEvent !== false) {
1221 this._events.next(new PristineChangeEvent(true, sourceControl));
1222 }
1223 }
1224
1225 /**
1226 * Marks the control as `pending`.

Callers

nothing calls this directly

Calls 3

_forEachChildMethod · 0.65
markAsPristineMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected