简体   繁体   中英

Add AND condition in Handlebars/HtmlBars template

In my Ember project, I have a button as below;

{{my-button label="Add"  enabled=(lt gridItems.length maxRecordsInGrid)}}

Currently I have the "enabled" property based on gridItems.length < maxRecordsInGrid I want to add a 2nd condition to this ie if a property called "enableBtn" is true

So, essentially, I want the "enabled" property to be an AND between;

  1. gridItems.length < maxRecordsInGrid
  2. enableBtn is true

Is it possible to do this directly in the template using some inbuilt HTMLBars condition without the need of explicit helpers?

This is not possible in ember itself.

You can use ember-truth-helpers for this.

There is an open RFC to add this to ember itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM