hasAll

Check if all the values are defined or true in order to execute the block code.

1
2
3
{{#hasAll [value1] [value2]...}}
...
{{/hasAll}}
Example
format JSON XML
Data JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"ProductOne": {
"name": "Chocolate",
"size": "small",
"quantity":"8",
"price": "1.00"
},
"ProductTwo": {
"name": "Candy",
"size": "small",
"quantity":"8"
}
}
Code
1
2
3
4
5
6
7
{{#hasAll ProductOne.name ProductOne.price}}
Yes we are selling chocolates!
{{/hasAll}}
{{#hasAll ProductTwo.name ProductTwo.price}}
Yes we are selling candies!
{{/hasAll}}
Result
Data XML
1
2
3
4
5
6
7
8
9
10
11
<data>
<ProductOne
name="Chocolate"
size="small"
quantity="8"
price="1.00" />
<ProductTwo
name="Candy"
size="small"
quantity="8" />
</data>
HTML
1
2
3
4
5
6
7
{{#hasAll data.ProductOne._name data.ProductOne._price}}
Yes we are selling chocolates!
{{/hasAll}}
{{#hasAll data.ProductTwo._name data.ProductTwo._price}}
Yes we are selling candies!
{{/hasAll}}
Result