jeudi 5 mai 2016

EmberJS, How to add a dynamic class to an input element that has already a bunch of classes?

I have this input element:

// template.hbs


And in the controller I have a computed property to define an extra class for the input field:

// controller.js
fieldClass: Ember.computed('controllerProperty', function() {
  if(this.get('controllerProperty') == "value_1") return "";
  if(this.get('controllerProperty') == "value_2") return "has-success";
  if(this.get('controllerProperty') == "value_3") return "has-error";
})

I would like to add this dynamic class to the list of already set classes. I have tried:



"}}








Aucun commentaire:

Enregistrer un commentaire