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 }}
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
A radio button group that has ngModel connected to it should be able to (pre)select the right radio button that corresponds to the model. Even if the selected part of the model is an object
Current Behavior
Currently no selection is made. I had similar issues with selects that seem to happen because of the linked model beeing (complex) objects. Implementing a custom [compareWith]=... helped there (by simply comparing ids). Otherwise only object reference seems to be compared. Radio buttons do not seem to have a similar attribute so this did not work here.
Possible Solution
Maybe add a custom way to compare for radio buttons?
Steps to Reproduce (for bugs)
Create radiobuttons with *ngFor based on an array of objects
Fill the "target" model, the one linked to the radio button via ngModel, with an exact copy of an object from the array (but not the same object, just a copy)
I am trying to display a form for a user to change existing data. Some of that should be displayed as a radio group where the selection from last time gets preselected on reopening.
The possible values for the radio buttons and the users selection get loaded seperately from a server. That is why they contain the same object (content wise) but have different object references, which seems to confuse ngx-materialize's radiobuttons.
Ignoring this problem I loved the library until now, so a fix or workaround for this would be great!
Your Environment
Version used: 6.1.1 (via npm)
Angular version used: 6
Browser Name and version: tested with chrome and firefox
Operating System and version (desktop or mobile): windows 10 desktop
If more information is needed I will try to provide that.
The text was updated successfully, but these errors were encountered:
Expected Behavior
A radio button group that has ngModel connected to it should be able to (pre)select the right radio button that corresponds to the model. Even if the selected part of the model is an object
Current Behavior
Currently no selection is made. I had similar issues with selects that seem to happen because of the linked model beeing (complex) objects. Implementing a custom [compareWith]=... helped there (by simply comparing ids). Otherwise only object reference seems to be compared. Radio buttons do not seem to have a similar attribute so this did not work here.
Possible Solution
Maybe add a custom way to compare for radio buttons?
Steps to Reproduce (for bugs)
Here is a stackblitz demonstrating the problem.
Context
I am trying to display a form for a user to change existing data. Some of that should be displayed as a radio group where the selection from last time gets preselected on reopening.
The possible values for the radio buttons and the users selection get loaded seperately from a server. That is why they contain the same object (content wise) but have different object references, which seems to confuse ngx-materialize's radiobuttons.
Ignoring this problem I loved the library until now, so a fix or workaround for this would be great!
Your Environment
If more information is needed I will try to provide that.
The text was updated successfully, but these errors were encountered: