ember.js - Ember: Add conditions in form-element to display field contents -
how add conditions in ember template. want achieve condition.
if(modalforadd == true) // if modalforadd true set model or property of each input textfield blank { {{bs-form-element controltype="text" label="quantity" property=""}} } else { {{bs-form-element controltype="text" label="quantity" property="model.quantity"}} }
here code 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}}
the if
helper has inline version can used subexpression.
you can do:
{{bs-form-element controltype="text" label="quantity" property=(if modalforadd "" "model.quantity")}}
Comments
Post a Comment