I have an input box based on below:
If I change the radio, I see that the value changes to true for false:
<pre> {{model_parameters_general.estimationmethod=='ew'}} </pre>
So wow, why will the input box be disabled based on true for false?
<input [disabled]="model_parameters_general.estimationmethod=='ew'" [(ngModel)]="model_parameters_general.lambda"
formControlName="lambda" type="text" class="form-control">
EDIT:
In the logs, I get the following:
It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
you. We recommend using this approach to avoid 'changed after checked' errors.
Example:
form = new FormGroup({
first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
last: new FormControl('Drew', Validators.required)
});
So, I am using reactive from rc6.
I set the initial disable below:
this.myForm = fb.group({
lambda: new FormControl({value: .99, disabled: true}, Validators.required),
})
So what can I enable based on switching radio input?
source
share