diff --git a/packages/forms/src/directives/ng_model.ts b/packages/forms/src/directives/ng_model.ts index b4e252a9cb..1a91885f27 100644 --- a/packages/forms/src/directives/ng_model.ts +++ b/packages/forms/src/directives/ng_model.ts @@ -136,6 +136,16 @@ const resolvedPromise = (() => Promise.resolve(null))(); export class NgModel extends NgControl implements OnChanges, OnDestroy { public readonly control: FormControl = new FormControl(); + + // At runtime we coerce arbitrary values assigned to the "disabled" input to a "boolean". + // This is not reflected in the type of the property because outside of templates, consumers + // should only deal with booleans. In templates, a string is allowed for convenience and to + // match the native "disabled attribute" semantics which can be observed on input elements. + // This static member tells the compiler that values of type "string" can also be assigned + // to the input in a template. + /** @nodoc */ + static ngAcceptInputType_disabled: boolean|string; + /** @internal */ _registered = false; diff --git a/tools/public_api_guard/forms/forms.d.ts b/tools/public_api_guard/forms/forms.d.ts index 756a1654d4..4780d5b0f7 100644 --- a/tools/public_api_guard/forms/forms.d.ts +++ b/tools/public_api_guard/forms/forms.d.ts @@ -415,6 +415,7 @@ export declare class NgModel extends NgControl implements OnChanges, OnDestroy { ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; viewToModelUpdate(newValue: any): void; + static ngAcceptInputType_disabled: boolean | string; } export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {