I have a model with a attribute with a value of "0" (zero). My template looks something like this:
{{#count}}{{{count}}} items{{/count}}
{{^count}}-{{/count}}
If myModel.count = 0
, the rendered html is nothing. It's like the value "count" is null and not null at the same time.
Mustache documentation for this case: https://github.com/janl/mustache.js#inverted-sections
@bobthecow answered it in his comment:
It won't display a zero because zero is falsey. One option to get it to display is to set it to a non-falsey value (like the string '0')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With