Closed wombatastronaut closed 2 years ago
I'm trying to use the condition inside the template but it's not working as expected.
Here's my full code:
<div id="template" role="template"> Name: {{ options.name }} <br /> {{if(options.name == 'John Doe')}} You're right {{#else}} You're not right {{/if}} </div> <div id="content"></div> <script src="https://cdn.jsdelivr.net/npm/squirrelly@7/dist/squirrelly.min.js"></script> <script> var template = document.getElementById('template').innerHTML; var content = document.getElementById('content'); var result = Sqrl.Render(template, { options: { name: 'John Doe' } }); content.innerHTML = result; </script>
But here's the result:
You can see that it didn't go to the if condition even though its true. I also render the name above and it has the correct value.
if
I'm trying to use the condition inside the template but it's not working as expected.
Here's my full code:
But here's the result:![image](https://user-images.githubusercontent.com/17607553/126592777-ef88d95c-f720-4b80-b97f-d99431eba293.png)
You can see that it didn't go to the
if
condition even though its true. I also render the name above and it has the correct value.