-
Notifications
You must be signed in to change notification settings - Fork 6.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
md-radio buttons in reactive forms (model based) cause several problems #1875
Comments
What's the reason you are using the |
Csaba, Thanks. I am following the instructions in Angular2's documentation
My md-inputs all follow this format from Angular2's reactive form
aria-labelledby="country" formControlName="country" Documentation is in Angular devdocs Cookbook for Dynamic Forms and in On Wed, Nov 16, 2016 at 2:49 AM, Csaba Szabo [email protected]
Mike Laird 12 Arbor Creek Drive, Pittsford, New York 14534 ". . . remembering on both sides that civility is not a sign of weakness, |
I removed formControlName from each md-radio-button, and put it once in the md-radio-group. This is not what the docs say for RadioControlValueAssessor, but it fixed problems 1. and 2. above. Problem 3, radio dots are not inside the circle remains. My question is whether this is a "lucky bandaide" fix that will cause some other problem in the future, or is Angular documentation wrong in several places? Also, why are the radio button dots off to the right of the circles? |
At long last, I found that Problem 3, radio dots are not inside the circle, is caused when a theme is not imported into the CSS. When I added this statement to the page's CSS, the radio buttons look and work fine. @import '/node_modules/@angular/material/core/theming/prebuilt/indigo-pink.css'; You may have to change it slightly depending upon your path to the prebuilt folder. It seems indigo-pink is the only theme that works, as of 12/22/16. All the others in the prebuilt folder break the page. The formControlName problems, #1 and #2, continue, as best I can tell in alpha.11-3 |
Thanks @mLaird, I just started with angular-md2 and ran into this same exact issue. Your solution seems to worked but at the same time seems like the most amazingly clugie-hack of all time. If someone could point out an explanation for this, then I would be most appreciative. There must be one since @jelbourn closed this. Thank you. |
@mLaird @jelbourn - No offense meant to my previous "amazingly clugie-hack of all time" comment above. I am totally under-the-gun to get a new project released this weekend and like I said wanted to try out angular-md2 for 1st time - trying to expand my horizons... Anyway, I appreciate everyone's time and effort in publishing and supporting open source. Thanks again and cheers. |
@mLaird Thanks buddy this help me too. Been trying to figure out why I am running into errors for two freaking hours. Angular should fix this. It's freaking annoying |
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. |
Bug, feature request, or proposal:
It is a bug, as best I can tell. I cannot tell whether the problem is in Angular or MD, code or docs.
What is the expected behavior?
md-radio buttons should not affect other DOM components, and they should work.
What is the current behavior?
1.When radio buttons are constructed in a reactive form with current Angular 2 docs, http://devdocs.io/angular~2_typescript/api/forms/index/radiocontrolvalueaccessor-directive , all the md-input elements disappear from the form page. When formControlName="something" is removed from md-radio-button elements, the md-input boxes re-appear. 2. Also when formControlName is present, the md-radio buttons do not switch from one to another. Each click adds another clicked circle to the group. When removed, only one click registers in each group, i.e., switch occurs. 3. Lastly, my radio button dots are not inside the circles, but I imagine that bug has already been reported.
What are the steps to reproduce?
I posted relevant code, and console errors at:
http://stackoverflow.com/questions/40597983/angular-2-md-radio-buttons-in-reactive-model-based-forms-dont-work-stop-md
I have tried a lot of things, and conclude the problem is a bug.
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd
What is the use-case or motivation for changing an existing behavior?
Make radio buttons behave as expected
Which versions of Angular, Material, OS, browsers are affected?
Angular 2.1.2, MD-alpha.10, Chrome, FF
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: