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

Method ngOnChanges

packages/forms/src/directives/ng_model.ts:257–281  ·  view source on GitHub ↗

@docs-private

(changes: SimpleChanges)

Source from the content-addressed store, hash-verified

255
256 /** @docs-private */
257 ngOnChanges(changes: SimpleChanges) {
258 this._checkForErrors();
259 if (!this._registered || 'name' in changes) {
260 if (this._registered) {
261 this._checkName();
262 if (this.formDirective) {
263 // We can't call `formDirective.removeControl(this)`, because the `name` has already been
264 // changed. We also can't reset the name temporarily since the logic in `removeControl`
265 // is inside a promise and it won't run immediately. We work around it by giving it an
266 // object with the same shape instead.
267 const oldName = changes['name'].previousValue;
268 this.formDirective.removeControl({name: oldName, path: this._getPath(oldName)});
269 }
270 }
271 this._setUpControl();
272 }
273 if ('isDisabled' in changes) {
274 this._updateDisabled(changes);
275 }
276
277 if (isPropertyUpdated(changes, this.viewModel)) {
278 this._updateValue(this.model);
279 this.viewModel = this.model;
280 }
281 }
282
283 /** @docs-private */
284 ngOnDestroy(): void {

Callers

nothing calls this directly

Calls 8

_checkForErrorsMethod · 0.95
_checkNameMethod · 0.95
_getPathMethod · 0.95
_setUpControlMethod · 0.95
_updateDisabledMethod · 0.95
_updateValueMethod · 0.95
isPropertyUpdatedFunction · 0.90
removeControlMethod · 0.65

Tested by

no test coverage detected