-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Model driven forms support for RadioButton #9162
Comments
Encounter the same issue. No issue in template-driven forms (ngModel). |
Encountering the same issue, the class for checked is not getting removed |
Same problem for me. I created a Stackblitz Demo to demonstrate de problem. |
Seems to be caused by; It is a pity that writeValue of p-radioButton is not called by Angular which would fix the issue. There are some workarounds in the link above but not ideal. Don't think if there is something on our end, feel free to provide feedback if you have any. |
But why it was working in primeng v.9 ? The angular issue is much older |
It's not only wrong for model driven forms. It also doesn't work without using any form at all, see here: https://primengdemo-adrcrr.stackblitz.io/ Furthermore I agree with @keschr and therefore this issue should be considered as a bug. Otherwise radio buttons are only usable with template-driven forms, which is too restrictive imho. |
For all who have the same problem, this workaround solves the problem for now: |
Giving high priority for 10.0.4., @mertsincan @yigitfindikli, this has been around for some time, let's resolve it this week. |
Fixed radiobutton with template-driven forms #9162
Fixed in #9265 |
Thanks for the solution. |
I also have the same issue. Can we have this fixed soon? i.e. new version |
I also have the same issue. |
Having the same issue! When can we expect the release with the fix? |
You refactored this fix to not handle case when But what if we don't provide formControlName and use formControl created by formly, for example. This fix is not applicable to this case. |
@yigitfindikli |
Same issue here. I'm using primeng: 10.0.3 |
For me it is working since 10.0.6, my current version is 11.0.0 |
It's still an issue in verion 11.2.0 |
Fixed for me after upgrading from 11.3.2 -> 11.4.2 |
In addition to this answer in version 10.0.3, if you are using p-radiobutton wrapper, it worked when I did it like this in the component used. import { NG_VALUE_ACCESSOR, ControlValueAccessor, AbstractControl, NgControl } from '@angular/forms';
@Component({
selector: 'wrapper-radio',
template: '<p-radioButton></p-radioButton>',
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => WrapperRadioComponent ),
multi: true
}]
})
export class WrapperRadioComponent implements AfterViewInit, ControlValueAccessor {
private control?: AbstractControl;
constructor(private injector: Injector) {
}
ngAfterViewInit(): void {
const ngControl = this.injector.get(NgControl);
if (ngControl) {
this.control = ngControl.control;
this.control.valueChanges.subscribe(e => {
this.control.setValue(e, { emitEvent: false });
});
}
}
} |
I'm submitting a ...
[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
The text was updated successfully, but these errors were encountered: