How to add radio button as an attribute to model and view it in a template.
If I got it right you are interested in checking the right radio button on some attributes in the model.
In this case your template should look like somewhat:
<script type="text/template" id="radio-template">
<input type="radio" <% f == "opt1" ? print("checked") :'' %> >
<input type="radio" <% f == "opt2" ? print("checked") :'' %> >
...
</script>
where f is the template variable you specified during the view setup, like:
var template = _.template($('#item-template').html(), {f: 'opt2'});
this.$el.html(template);
Not that you can either use only checked
or checked="true"
EDIT
Then your template should look like:
<script type="text/template">
<label>Age:</label> <input type="text" name="age" value="<%= age %>">
<label>Radio:</label> <input type="radio" value="<%= modelAttribute%>">
</script>