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
Investigate ways to reduce the markup needed when writing select elements when the value exists in the model.
For example, perhaps a setup below will take the <select> element value and automatically apply the selected attribute to a matching option element.
// data passed to teddy templateconstmodel={foo: 'b'}
<!-- teddy template --><selectselected-value="{foo}" ...><optionvalue="a">A</option><optionvalue="b">B</option><!-- this receives the "selected" attribute on render --><optionvalue="c">C</option></select><!-- rendered result --><select...><optionvalue="a">A</option><optionvalue="b" selected>B</option><optionvalue="c">C</option></select>
The value attribute would also need to be removed from the <select> element, since it is not a valid attribute for the element.
Investigate ways to reduce the markup needed when writing select elements when the value exists in the model.
For example, perhaps a setup below will take the
<select>
element value and automatically apply theselected
attribute to a matching option element.The
value
attribute would also need to be removed from the<select>
element, since it is not a valid attribute for the element.It could also be extended to looped options:
For reference, this is how the first example is currently achieved:
Needs to handle checkboxes and radio buttons too though which is a trickier problem.
The text was updated successfully, but these errors were encountered: