I know how to filter an array with an input text as the filter. Is it possible to use the filter property of angularjs with a combobox as the filter options?
For example, I have an array of years: [2014,2014,2013,1987,1987] I want to filter this array using a combobox with these values : {blank,2014,2013,1987} In this combobox, if I click on blank, the array displays the initial values, otherwise it displays the filtered values.
The code below doesn't allow me to re init the array if I click on the first option of the Select tag :
<select ng-model="search.date" ng-options="year for year in years">
<option value=""></option>
</select>
<table class="table table-striped">
<thead>
<tr>
<th>Label</th>
<th>Categorie</th>
<th>Montant</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="budget in filteredBudgets | filter:search:strict">
<td>{{budget.label}}</td>
<td>{{budget.category}}</td>
<td>{{budget.real}}</td>
<td>{{budget.date}}</td>
</tr>
</tbody>
</table>
Thanks in advance.
<select ng-model="search.date" ng-options="year for year in years"><option value=""></option> </select><br> <tr ng-repeat="budget in filteredBudgets | filter:search:strict">....</tr>
sorry, i don't know how to go to next line with the short answer command. – user1260928 May 21 at 17:02