dimanche 19 février 2017

ember/handlebars - How to toggle object class based on boolean?

I have a form styled with bootstrap4 and am using ember-cp-validations to validate it.

  <div class="form-group ">
    <label for="name" class="cols-sm-2 control-label">Full Name</label>
    <div class="cols-sm-10">
      <div class="input-group">
        <span class="input-group-addon"></span>
        
      </div>
    </div>

    
      
        <div class="form-control-feedback container">
          <span></span>
        </div>
      
    
  </div>

Using , I am able to set the class to has-danger when showNameError is true, however when it is false, the class remains there and the has-danger persists.

  1. When the page loads step 1

  2. When I force the error step 2

  3. After I fix the error enter image description here

As you can see, after I fix the error the has-danger class remains. My question is, can I make it so the class toggles based on whether the input is valid or not.




Aucun commentaire:

Enregistrer un commentaire