mercredi 27 janvier 2016

Ember: Add conditions in form-element to display field contents

How to add conditions in Ember template. What I want to achieve is like this condition.

if(modalForAdd == true) // if modalForAdd is true then set the model or the property of each input textfield to blank
{
  {{bs-form-element controlType="text" label="Quantity" property=""}}
}
else 
{
  {{bs-form-element controlType="text" label="Quantity" property="model.quantity"}}
}

Here is my code for template

    {{#bs-modal open=openModalForDetails title="Add new Order" body=false footer=false}}
    {{#bs-modal-body}}
       {{#bs-form model=this action=(action "SaveNewOrder" model "this")}}
          {{bs-form-element controlType="text" label="Item SKU" property="model.item" id="item"}} 
          {{bs-form-element controlType="text" label="Quantity" property="model.quantity" id="quantity"}} 
          {{bs-form-element controlType="text" label="Description" property="model.description" id="description"}} 
          {{bs-form-element controlType="text" label="Discount" property="model.discount" id="discount"}} 
          {{bs-form-element controlType="text" label="Coupon" property="model.coupon" id="coupon"}} 
          {{bs-form-element controlType="text" label="Price" property="model.price" id="price"}} 
       {{/bs-form}}
    {{/bs-modal-body}}
    {{bs-modal-footer closeTitle="Cancel" submitTitle="Add"}}
{{/bs-modal}}




Aucun commentaire:

Enregistrer un commentaire