Mustache: Conditional Sections
[
View Tutorial
]
Mustache Template:
Available Products:
Name: {{name}}
Price: ${{price}}
{{#inStock}}
Buy Now!
{{/inStock}} {{^inStock}}
Sorry, out of stock.
{{/inStock}}
Data Object:
var data = { "name": "SuperWidget", "price": "19.99", "inStock": true };
Process Template
HTML Result:
How It Looks: