Closed lolbat closed 3 years ago
I have an object that I am rendering in JSRender. Almost everything works except for the evaluation of a nested object I have.
"traits": { "admin": true, "editor": true, "writer": true }
It is part of a larger object that I am sending to the template.
I have been trying to get JSRender to display an icon next to a name based on the traits.
{{if traits.admin}} <div class="icon iconadmin"></div> {{else traits.editor}} <div class="icon iconeditor"></div> {{else traits.writer}} <div class='icon iconwriter'></div> {{/if}}
I have tried using a series of distinct {{if}} tags as well but in each case the template only renders the first icon the user has in their traits object.
{{if}}
The template will render correctly if I use {{props}}
{{props}}
{{props traits}} {{if prop}} <div class="icon icon{{>key}}"></div> {{/if}} {{/props}}
There must have been some issue in the template or the CSS that was rendering it but I have retested and the issue is no longer a problem
I have an object that I am rendering in JSRender. Almost everything works except for the evaluation of a nested object I have.
It is part of a larger object that I am sending to the template.
I have been trying to get JSRender to display an icon next to a name based on the traits.
I have tried using a series of distinct
{{if}}
tags as well but in each case the template only renders the first icon the user has in their traits object.The template will render correctly if I use
{{props}}