In AngularJS, ng-options
lets one specify an array of any values, not just strings, while preserving types. For example, I might create an HTML select
using ng-options
over an array of integers. When an option is selected, the integer value is placed into the model—no string-to-int conversion necessary.
In Elm, an option's value
attribute accepts only a string, and thus the select
's onInput
event sends back a string. Then I have to manually convert it to an int.
Does Elm have any equivalent to AngularJS's ng-options
? Or any way to use a select
with arbitrary, even non-scalar, values?