-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update radio button directive to work with ReactiveForms #1023
Update radio button directive to work with ReactiveForms #1023
Conversation
Ahhhh, we need this for all components:
|
Reactive Forms Example
|
Template Forms Example
|
Looks like the linter is preventing the use of forwardRef, but this seems to be necessary to get the ControlValueAccessor working correctly (see mgechev/angular2-style-guide#56 for other possible uses of forwardRef). |
+1 one this one |
@bjornharvold this issue is closed and already fixed by 5d51939 |
Can someone show me a html markup and typescript example to use in ReactiveForms? |
Can someone show me a html markup and typescript example to use in ReactiveForms? https://github.com/ng-bootstrap/ng-bootstrap/pull/1299/files I have tried using markup from the above link but with no luck. thanks |
@roscopeeco Having the same problem. Did you manage to make it work? |
No unfortunately not have ended up writing a custom input control |
The current implementation of btnRadio only works if there is an [(ngModel)] binding on the element, and does not work correctly with ReactiveForms.
This PR removes the dependency upon ngModel while allowing the btnRadio directive to work in both a ReactiveForms (with formControlName) or TemplateForms (with [(ngModel)] environment. Furthermore, there is a change to the btnRadio to make it an object so that it can be correctly compared to the model object.