You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
md-radio buttons in reactive forms (model based) cause several problems #1875
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's the reason you are using the FormControlName on the md-radio-button and not on the md-radio-group? May I see the whole code you have, with the md-inputs as well? I think you should use the FormControlName on the group rather then on the individual elements, at least for me it's working. thanks
Csaba, Thanks. I am following the instructions in Angular2's documentation
for the RadioControlValueAssessor in reactive forms. Check the link I
included. Here's the code example:
What's the reason you are using the FormControlName on the md-radio-buttonand
not on themd-radio-group? May I see the whole code you have with themd-input`s?
I think you should use the FormControlName on the group rather then on the
individual elements, at least for me it's working. thanks
". . . remembering on both sides that civility is not a sign of weakness,
and sincerity is always subject to proof. Let us never negotiate out of
fear, but let us never fear to negotiate." - John F. Kennedy
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.
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
angular-automatic-lock-bot commented on Sep 7, 2019
Activity
csabattilas commentedon Nov 16, 2016
What's the reason you are using the
FormControlNameon themd-radio-buttonand not on themd-radio-group? May I see the whole code you have, with themd-inputs as well? I think you should use theFormControlNameon the group rather then on the individual elements, at least for me it's working. thanksmLaird commentedon Nov 16, 2016
Csaba, Thanks. I am following the instructions in Angular2's documentation
for the RadioControlValueAssessor in reactive forms. Check the link I
included. Here's the code example:
My md-inputs all follow this format from Angular2's reactive form
documentation:
aria-labelledby="country" formControlName="country"
i18n-placeholder="select country placeholder" placeholder="Country"
type="text" size="30" maxlength="30">
Documentation is in Angular devdocs Cookbook for Dynamic Forms and in
http://blog.angular-university.io/introduction-to-angular-2-forms-template-driven-vs-model-driven/
On Wed, Nov 16, 2016 at 2:49 AM, Csaba Szabo notifications@github.com
wrote:
Mike Laird
12 Arbor Creek Drive, Pittsford, New York 14534
mlaird@alum.mit.edu
". . . remembering on both sides that civility is not a sign of weakness,
and sincerity is always subject to proof. Let us never negotiate out of
fear, but let us never fear to negotiate." - John F. Kennedy
mLaird commentedon Nov 17, 2016
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?
mLaird commentedon Dec 22, 2016
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
kinggolf commentedon Feb 16, 2017
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.
kinggolf commentedon Feb 16, 2017
@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.
molayodecker commentedon Nov 28, 2017
@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
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.