The following expressions describe the expression format and samples for block helpers. Variables and “hard-coded” values may be nested and referenced.
|
Template |
{{#if contact.phone}}{{contact.phone}}
{{else}} Phone number not found
{{/if}}
|
|---|---|
|
Context |
{
"contact": {
"name": "Jack Parsons Laboratory",
"phone": "310-555-1234"
}
}
|
|
Output |
310-555-1234 |
Block helpers may also be nested, as shown below.
|
Template |
{{#compare customer1 "==" "2"}}
{{#compare customer2 "==" "5"}}
True
{{else}}
False
{{/compare}}{{else}}
False
{{/compare}}
|
|---|---|
|
Context |
{
"customer1": "2",
"customer2": "5"
}
|
|
Output |
True |