Closed frabrunelle closed 9 years ago
I've added a radio
binding in 0.5.5
and updated the docs and the verbose
example. Check out the example, and maybe have a glance at how the new binding works. It's extremely simple :)
The way I normally make something like a switch statement in Blaze, is with a global is
helper (some prefer to call it $is
):
Template.registerHelper("is", function (first, second) {
return first === second;
});
{{#if is value 'radio1'}}
<p>radio 1</p>
{{else}}{{#if is value 'radio2'}}
<p>radio 2</p>
{{else}}
<p>radio 3</p>
{{/if}}{{/if}}
Thank you! The radio
binding works perfectly and I like your solution for making a switch statement in Blaze :smiley:
Those switch statements look way nicer with Jade (which I haven't been using so far, but might change to, soon).
At the moment, I'm working on an extension to mquandalle:jade
that makes binding syntax much more tolerable with that language.
Have you thought about how the ViewModel pattern could be applied to radio buttons? :smiley:
I am trying to integrate it right now but it doesn't seem to work. My use case is that I have a form that allows the creation of a member and there are radio buttons which can be used to select the level of the member (1, 2 or 3). And depending on the level chosen, I would show additional inputs.