mercredi 9 janvier 2019

Is there a more "ember way" to compute this value?

Note: I am forced by circumstance to use Ember 2.18, but interested if ^3.4 has it if 2.x does not.

I am computing a Boolean based on two other Boolean. Inside the class there is this:

userEmail: '',
feedbackText: '',
emailIsValid: match('useEmail' /^.+@.+\..+$/),
feedbackTextIsValid: gte('feedbackText.length', 5),
disableSubmit: computed('emailIsValid', 'feedbackTextIsValid', function() {
  return (!this.get('emailIsValid) || !this.get('feedbackTextIsValid'));
}),

In other words, the property disableSibmit should be true if userEmail is not a valid email or if feedbackText is less than 5 characters. It does this properly

What I am wondering is if I can use something similar to not or match to return True If either of 2 other values is not True




Aucun commentaire:

Enregistrer un commentaire