Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{{!This is a Comment -- You can use Comments much like // or ' in other programming languages}}
<strong>Conditional Examples:</strong><br/>
{{!if something has a value}}
{{#if submissionForm.managerSEmail}}
Manager Email: {{submissionForm.managerSEmail}}
{{else}}
Manager Email is Empty
{{/if}}
<hr/>
{{!unless something has a value}}
{{#unless submissionForm.doNotContactManager}}
Contact the Manager
{{else}}
Do not Contact the Manager
{{/unless}}
<hr/>
{{!ifCond allows for equals, not equals, greater than, less than}}
{{!ifCond aliasOrValue "operator" aliasOrValue}}
{{!Operators are ==, !=, >, >=, <, <=}}
{{#ifCond (tableLength submissionForm.favoriteMenuItems) "==" 1}}
One Rows in Table
{{else}}
{{tableLength submissionForm.favoriteMenuItems}} Rows in Table
{{/ifCond}}
<hr/>
{{#ifCond (tableLength submissionForm.favoriteMenuItems) "!=" 1}}
Some Value other than 1 Row in Table
{{/ifCond}}
<hr/>
{{!Shortcut notation exists eq for ==; notEq for !=}}
{{!Shortcut notation exists for gt for >, gte for >=, lt for <, lte for <=}}
{{#eq (tableLength submissionForm.favoriteMenuItems 1)}}
One Rows in Table
{{else}}
{{tableLength submissionForm.favoriteMenuItems}} Rows in Table
{{/eq}}
<hr/>
{{#notEq (tableLength submissionForm.favoriteMenuItems) 1}}
Some Value other than 1 Row in Table
{{/notEq}}
<hr/>
{{#ifCond (tableLength submissionForm.favoriteMenuItems) ">" 1}}
Table Length is Greater Than 1
{{/ifCond}}
<hr/>
{{#gt (tableLength submissionForm.favoriteMenuItems) 1}}
Table Length is Greater Than 1
{{/gt}}
<hr/>
{{!AND, OR, NOT}}
{{#and (eq (tableLength submissionForm.favoriteMenuItems) 3) (eq submissionForm.title "McDonald's")}}
Both True
{{else}}
At Least Once False
{{/and}}
<hr/>
{{#or (eq (tableLength submissionForm.favoriteMenuItems) 0) (eq submissionForm.title "McDonald's")}}
At Least One True
{{else}}
Both False
{{/or}}
<hr/>
{{!Not with preview of next chapter}}
{{#not (contains submissionForm.managerSEmail "@")}}
No @ in Email
{{else}}
Email is OK
{{/not}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment