【发布时间】:2014-05-21 16:42:14
【问题描述】:
我知道如何以输入文本作为过滤器来过滤数组。 是否可以使用带有组合框的 angularjs 的过滤器属性作为过滤器选项?
例如,我有一组年份:[2014,2014,2013,1987,1987] 我想使用具有以下值的组合框过滤此数组:{blank,2014,2013,1987} 在此组合框中,如果单击空白,则数组显示初始值,否则显示过滤后的值。
如果我单击 Select 标记的第一个选项,下面的代码不允许我重新初始化数组:
<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>
提前致谢。
【问题讨论】:
-
不清楚,为什么不分享你的 html 和编码的应用程序到目前为止
-
我的代码:
<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>抱歉,我不知道如何使用简答命令转到下一行。 -
您知道您可以编辑您的问题并将其包含在其中吗?