jeudi 2 juillet 2015

Add a computed property to a select prompt

I'd like to render a prompt which reads "All products (500)". 500 being the total number of available products. prompt="All products {{filteredProductsCount}}" doesn't work.

What do I have to change to add the value of filteredProductsCount to the prompt?

controller.js

filteredProductsCount: function() {
  var filteredProducts = this.get('filteredProducts');
  return filteredProducts.length;
}.property('filteredProducts')

template.hbs

{{view "select" prompt="All products"
       content=filteredProducts
       value=selectedProduct
       class="form-control"}}




Aucun commentaire:

Enregistrer un commentaire