-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RC 6 Reactive Forms doesn't support disabled binding #11324
Comments
This looks like a dupe of #11271. |
You also can use the function enable() or disable() |
I could disable in the FormBuilder like this: id:[{value:'1', disabled:true}] However my problem is ngSubmit is not sending back value of this disabled field. it will be undefined for id save(model : any ) : void { How can I access the value of disabled field? Edit: I could find a workaround here |
ngOnChanges(changes){ |
This is pretty horrible. |
choui's solution works fine! That said, I do wish there was a property in the view I could bind to, to avoid all the component code. // works: |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I recently upgraded my project to RC 6. In my app we are using Reactive Forms. Among form fields there is a field which needs to be conditionally disabled.
Prior to RC 6 we were able to achieve this by applying disabled like like this.
<input formControlName="myField" type="text" [disabled]="form.controls.otherField.value">
After upgrade when I browse to that component, I see below warning in console.
I believe the the option to disable form field should be supported with Reactive Forms as well.
Currently to overcome this warning, we have to capture change event on otherField
(change)="onChange()"
The text was updated successfully, but these errors were encountered: