Search code examples
ember.jshtmlbars

Bind more controller properties to one attribute using HTMLBars


is this correct or is there any other solution?

<input disabled={{model.isnValid}} disabled={{isSaving}}>

I know that I can create new CP and depend on model.isnValid and isSaving, but I want to know if there is any other solutions.

Thank you for advices


Solution

  • Using a computed property is probably best here. Another potential solution is ember-truth-helpers which would allow you to write code such as:

    <input disabled={{or model.isInvalid model.isSaving}}>
    

    I use ember-truth-helpers a lot, but that just looks weird and I wouldn't recommend it.