I need to have an attribute which can have value of zero (0
)
Riot template:
<my-tag time="{ time }">
this.time = condition ? '10' : '0'
</my-tag>
Desired result:
<my-tag time="0"></my-tag>
However, Riot automatically omits whole attribute if it has falsy value:
<my-tag></my-tag>
My current workaround:
this.on('updated', () => {
$(this.root).attr('time', this.time)
})
In other words, i need time
attribute to have exact value of time
property.
Edit:
Looks like this has changed since 2.2.4.
this works as expected - both tags have rendered attribute time
with according value
this fails - tag with attribute set to false
has whole attribute removed