I have a input box based on the below:
If a change a radio I see that the value changes to true for false:
{{model_parameters_general.est
It seems in rc.6 they have removed the ability to disable inputs dynamically on a template binding when using reactive forms. You have to monitor changes and call .disable()
on the formControl
you wish to disable now. I rather prefer the old way of doing things and hope that they bring it back or an equally useful solution.
Chime in on this related github issue.
Try using attr.disabled, instead of disabled
<input [attr.disabled]="disabled?'':null"/>
StackOverflow Answer
For boolean properties you need to set them to null
to get them removed
<input [disabled]="model_parameters_general.estimationmethod=='ew' ? true : null" [(ngModel)]="model_parameters_general.lambda"
formControlName="lambda" type="text" class="form-control">
Try following code.
setControl(name: any, Isenable: boolean): void {
let ctrl = this.checkInForm.controls[name];
console.log(ctrl);
Isenable ? ctrl.enable() : ctrl.disable();
}
Calling Statement
this.setControl('ctrl name', true); // enbale it
this.setControl('ctrl name', false); // disable it
Thanks Happy Coding!