diff --git a/packages/forms/src/directives/reactive_directives/form_control_directive.ts b/packages/forms/src/directives/reactive_directives/form_control_directive.ts index 547ea216d1923..d64cd1e5f9058 100644 --- a/packages/forms/src/directives/reactive_directives/form_control_directive.ts +++ b/packages/forms/src/directives/reactive_directives/form_control_directive.ts @@ -125,7 +125,9 @@ export class FormControlDirective extends NgControl implements OnChanges { this.form.updateValueAndValidity({emitEvent: false}); } if (isPropertyUpdated(changes, this.viewModel)) { - _ngModelWarning('formControl', FormControlDirective, this, this._ngModelWarningConfig); + if (typeof ngDevMode === 'undefined' || ngDevMode) { + _ngModelWarning('formControl', FormControlDirective, this, this._ngModelWarningConfig); + } this.form.setValue(this.model); this.viewModel = this.model; } diff --git a/packages/forms/src/directives/reactive_directives/form_control_name.ts b/packages/forms/src/directives/reactive_directives/form_control_name.ts index 9e76a3f91ad8e..fe5044c6ed621 100644 --- a/packages/forms/src/directives/reactive_directives/form_control_name.ts +++ b/packages/forms/src/directives/reactive_directives/form_control_name.ts @@ -145,7 +145,9 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy { ngOnChanges(changes: SimpleChanges) { if (!this._added) this._setUpControl(); if (isPropertyUpdated(changes, this.viewModel)) { - _ngModelWarning('formControlName', FormControlName, this, this._ngModelWarningConfig); + if (typeof ngDevMode === 'undefined' || ngDevMode) { + _ngModelWarning('formControlName', FormControlName, this, this._ngModelWarningConfig); + } this.viewModel = this.model; this.formDirective.updateModel(this, this.model); } diff --git a/packages/forms/src/directives/shared.ts b/packages/forms/src/directives/shared.ts index 3a69960447534..a66893ec0b833 100644 --- a/packages/forms/src/directives/shared.ts +++ b/packages/forms/src/directives/shared.ts @@ -6,8 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {isDevMode} from '@angular/core'; - import {AbstractControl, FormArray, FormControl, FormGroup} from '../model'; import {getControlAsyncValidators, getControlValidators, mergeValidators} from '../validators'; @@ -324,13 +322,11 @@ export function removeListItem(list: T[], el: T): void { export function _ngModelWarning( name: string, type: {_ngModelWarningSentOnce: boolean}, instance: {_ngModelWarningSent: boolean}, warningConfig: string|null) { - if (!isDevMode() || warningConfig === 'never') return; + if (warningConfig === 'never') return; if (((warningConfig === null || warningConfig === 'once') && !type._ngModelWarningSentOnce) || (warningConfig === 'always' && !instance._ngModelWarningSent)) { - if (typeof ngDevMode === 'undefined' || ngDevMode) { - ReactiveErrors.ngModelWarning(name); - } + ReactiveErrors.ngModelWarning(name); type._ngModelWarningSentOnce = true; instance._ngModelWarningSent = true; }