Closed jliuhtonen closed 10 years ago
After thinking about this for a while I guess I'll just go with Bacon.Binding. Changing the way radioGroupValue checks for value equality on calling set would be a bad idea. Now equality is checked with CoffeeScript's is. JS type coercion is kinda nasty and IMO should be avoided anyway. A method for creating conversions in Bacon.Model would create little to none extra value. If this a common case, then maybe a Bacon.$.intRadioGroupValue (or something) could be a nice utility.
I've run into the same issue myself (integer values). PR with full solution will be accepted :)
Bacon.jquery does not currently support using other types than strings with the models it creates. Trying to set model value to integer for example does not reflect to the UI, which is understandable as the values are strings in the DOM after all.
Anyway, it would be nice to use e.g. numbers with your Bacon.$.radioButtonGroup and hide the conversions from application logic. For example:
One can work around this by making a bidirectional conversion between types with Bacon.Model's Bacon.Binding, like in this fiddle: http://jsfiddle.net/jliuhtonen/EfmLU/
Or perhaps make some changes to bacon.jquery directly...
Do you think that it would be useful to have something like this in Bacon.Jquery or Bacon.Model?