Skip to content
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

hc-radio-button doesn't support ngValue #2180

Open
isaaclyman opened this issue Jun 21, 2023 · 0 comments
Open

hc-radio-button doesn't support ngValue #2180

isaaclyman opened this issue Jun 21, 2023 · 0 comments

Comments

@isaaclyman
Copy link
Contributor

Summary

For all HTML elements that support the value attribute, Angular also provides the ngValue attribute, which allows binding non-string expressions to the value of a form element.

Cashmere's hc-radio-button is not a native HTML element, but the presence of the value field might lead Angular devs to expect that it also supports ngValue and that they work in the same way. This isn't true. When you try to use it, it silently fails: the attribute doesn't do anything and you don't see any console errors.

The value field on HcRadioButton supports any kind of data, not just strings, so ngValue isn't necessary. Still, it's an easy and automatic trap to fall into.

Reproduction

Steps to reproduce:

  1. Use [ngValue] instead of [value] on an hc-radio-button.

Additional context

Related: #969, #963, #779 - it looks like we've previously addressed this with hc-select.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant