user1941537
user1941537

Reputation: 6675

Handlebars - Is this syntax valid?

Is the following syntax valid in Handlebars.js?

{{#if !results}}
      <h1>There are no results</h1>
{{/if}}

The h1 should be displayed only if there are no results.

Upvotes: 0

Views: 873

Answers (1)

mhu
mhu

Reputation: 18051

You should use the unless helper:

{{#unless results}}
  <h1>There are no results</h1>
{{/unless}}

Upvotes: 2

Related Questions