Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input helper ember reverse disabled state

Tags:

ember.js

I want to disable an inputfield if a property is false or does not exist. To do this, you should need a reverse binding for the input helper, something like (pseudo code):

{{ input ... disabled=!isNew}}

After reading the docs, I could find nothing about reverse boolean structure.

Should I solve this by using a computed property*, or is there a better way?


* Something like:

loginFieldDisabled: function() {
    return ! this.get('isNew');
}.property('isNew')
like image 499
Jacob van Lingen Avatar asked Feb 12 '23 18:02

Jacob van Lingen


1 Answers

For those who came to question by googling, currently you could use the Ember Truth helpers to achieve a solution for this problem:

{{input ... disabled=(not isNew)}}
like image 184
Jacob van Lingen Avatar answered Mar 12 '23 03:03

Jacob van Lingen