Search code examples
ember.jshandlebars.js

Handlebars conditionals - boolean properties only?


Quick question. Is it possible to evaluate things other than a Boolean property in a handlebars conditional?

eg This works

//elsewhere...  myproperty = true
{{#if myproperty}}...

Any way other conditionals can be done? eg

//elsewhere...  myproperty = 3
{{#if myproperty<4}}...

Solution

  • You cannot do {{#if myproperty<4}} in the template.

    See the following question for an example of what to do in such a case

    How do I make a conditional helper with ember-cli and handlebars 2.0.0?