lundi 6 avril 2015

Set the value of a form from the controller

I have categories which have many products and a form which displays drop-down menus of both. Once a Category gets picked the values of the Product drop-down get filtered so that only products which belong to the category get displayed. That works fine until the user sets the selectedProduct drop-down to a specific value.


How can I reset the selectedProduct drop-down to All Products if the user clicks on a different Category after he clicked on a Product?


app/templates/index.hbs



{{view "select" prompt="All Categories"
content=filteredCategories
optionLabelPath="content.name"
optionValuePath="content.name"
value=selectedCategory}}

{{view "select" prompt="All Products"
content=filteredProducts
optionLabelPath="content.name"
optionValuePath="content.name"
value=selectedProduct}}




Aucun commentaire:

Enregistrer un commentaire