Simple answers for simple questions:
{{#unless isValid}}
{{/unless}}
Also keep in mind that you can insert an {{else}}
in between an {{#if}}
or {{#unless}}
and the closing tag.
You have many ways of doing that.
{{unless}}
:{{#unless isValid}}
...
{{else}}
...
{{/unless}}
{{#if (if isValid false true)}}
...
{{else}}
...
{{/if}}
{{#if (not isValid)}}
...
{{else}}
...
{{/if}}
it can be done in multiple ways.
1 use unless
{{#unless IsValid}}
<Your Code>
{{/unless}}
2.use if else
{{#if IsValid}}
{{else}}
<Your Code>
{{/if}}
3.use not
helper
{{#if (not IsValid)}}
<Your Code>
{{/if}}
unless
block helper (built-in helper)
unless
helper is the inverse of the if
helper.
Its block will be rendered if the expression returns a falsy value.
{{#unless valid}}
<h3 class="warning">WARNING</h3>
{{/unless}}
{{#if items.length}}
//Render
{{/if}}
Here items.length .. if it returns some value except null, then only it will enters into the if loop.
NOTE : You can check Boolean values also. In If block
{{#if booleanFloag}}
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