-
Notifications
You must be signed in to change notification settings - Fork 6.8k
mat-slide-toggle: does not always follow formGroup initialization state #8022
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
Comments
This issue is present for any custom form component in angular material.
Stackblitz with all material form controls: https://stackblitz.com/edit/angular-material2-formgroup-issue |
This sounds pretty similar to #6849. Note that using the I guess one of the differences is, in your all control example, the input/autocomplete/datepicker controls do get disabled, they just don't run change detection until you click on them. The other controls do not disable at all. |
@tinayuangao can you investigate this? @kara should be able to help with forms-related questions |
This is related to forms. The https://github.com/angular/angular/blob/a176cd646c63dd3cdbcb3b593e15da2d8b1bd975/packages/forms/src/directives/reactive_directives/form_control_directive.ts#L92 |
@tinayuangao is it working as intended, then? |
Yes. The |
Close this issue for now. Please feel free to reopen when angular forms supports it. |
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. |
Uh oh!
There was an error while loading. Please reload this page.
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Given I have a form group with a slide toggle set as disabled: true
When recreating the form group with the slide toggle set as disabled: false
Then the slide toggle should be enabled.
Given I have a form group with a slide toggle set as disabled: false
When recreating the form group with the slide toggle set as disabled: true
Then the slide toggle should be disabled.
What is the current behavior?
After first form group initialization, the slide toggle state isn't affected by the disabled setting in subsequent form group initialization.
What are the steps to reproduce?
In an Angular component, with a formGroup:
And a form template:
At any point during the lifetime of the component, recreate the form group but with a different disabled state for the controls:
The input will have correctly changed disabled state, however the slide toggle will not.
https://stackblitz.com/edit/angular-material2-issue-slide-toggle
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.4.6
Angular Material 2.0.0-beta.12
tested in Chrome
Is there anything else we should know?
Similar issues: #4774 (fix: #4797)
The text was updated successfully, but these errors were encountered: