I think this is conform to the documentation at https://atmospherejs.com/meteor/spacebars (under “In attribute values”).
BUT the checkbox is always showing as checked! It is just showing as <input type="checkbox"> in chrome dev tool and I can’t tell how to troubleshoot where the checked state is coming from.
While processing files with templating (for target web.browser):
m2.html:14: Reactive HTML attributes must either have a constant name or consist of a single {{helper}}
providing a dictionary of names and values. A template tag of type BLOCKOPEN is not allowed here.
...nput type="checkbox" {{#if isChecked}}che...
An attribute value that consists entirely of template tags that return null,
undefined, or false is considered absent; otherwise, the attribute is
considered present, even if its value is empty.
Yeah, that looks like a typo in the docs, easily done in this situation, the checked attribute was always confusing.
It’s probably worth raising an issue just because this section of the readme is so specific about how to format things that it makes it extra confusing when the example is wrong. And yes, meteor/issues with a link to the page would be best I reckon.
I hate to bring this back up, but I’m having the same issue as the OP. I have values stored as true or false, and I need / want to show them as checked or unchecked checkboxes in my UI.
I can now make the checkbox check or uncheck using a helper and statically returning true or false. But if I just use the value in the UI my checkbox is always checked. My value key is ‘selected’. So in the UI if I do
<input type="checkbox" checked="{{selected}}" >
then it is always checked, but I know only 1 out of 7 values for selected show ‘true’ when I just put
{{selected}}
in my UI directly.
I have created a helper called ‘isSelected’ as follows:
I’m using a helper on a different template to pull back all my values from the collection, but when I try to put the isSelected in that helper section I don’t get anything returned.