jeudi 12 février 2015

Pass a non-bound input value to arraycontroller via an action in ember

I'm rendering a iterative template that contains an input field and an action to my array controller, I can happily pass the current model but I'm a loss as to how to pass the unbound input value contents.


To give a totally simple example, think of a list of products template on an ecomms site, with a qty field and update button.



{{#each product in controller}}
{{product.name}}
<input name="qty" placeholder="Qty" />
<button {{action addToCart product}} ></button>
{{/each}}


This is a simple product list, not a view cart contents list so the qty field has no business being a part of the product model. I need qty to remain unbound (always loading blank)


How can I pass the value of the qty field to the addToCart action?





Aucun commentaire:

Enregistrer un commentaire