Using can 2.2
: I'm having trouble getting a radio input field to be checked by default when also using the can-value
attribute.
The relevant part of the stache template looks like this:
<input type="radio" name="visibility" value="corporate" can-value="reportData.visibility" checked="checked"/>
The relevant part of my viewModel looks like this:
can.Map.extend({
reportData = {
visibility: 'corporate',
}
});
I want the input value to be live-bound to my view model. According to the can 2.2 docs, I can use the can-value attribute on an input to reference a property on my view model and keep it in sync with the value of the input's value. My problem is the checked="checked"
doesn't result in the input being checked by default, though the value on the input item (corporate
) is being correctly live-bound. If I remove the can-value
attribute, the check appears by default. How can I get both live-binding and a checked input by default with the help of can-value
?