我正在實現一個搜索輸入框,該框應根據要迭代的對象的特定屬性進行搜索,我希望使用單選按鈕選擇它們。基於無線電選擇的AngularJS過濾器
例如這裏是我的代碼:
<span style="margin-bottom: 10px; display: inline-block;">Search: <input ng-model="searchText.CustomerName" /> </span>
<table id="Table1" class="alertTable">
<thead>
<tr>
<th class="xsmCol"><img src="/App_Themes/SkyKick/images/misc/clear.gif" class="iFlag" /></th>
<th>Subject</th>
<th>Customer</th>
<th>Type</th>
<th>Date</th>
<th class="smCol">Actions</th>
</tr>
</thead>
<tbody id="tbAlerts">
<tr ng-repeat-start="alert in alerts | filter:searchText" > <!-- | filter:searchText -->
<td><img src="/App_Themes/SkyKick/images/misc/clear.gif" data-tooltip="{{ alert.tooltip }}" class="{{ 'iAlert' + alert.AlertType }}"/></td>
<td><a href="Show Alert Details" ng-click="showAlertDetails($event)">{{ alert.Summary }}</a></td>
<td>{{ alert.CustomerName }}</td>
<td>{{ alert.CreatedDate }}</td>
<td>{{ alert.Category }}</td>
<td>
<!-- Tricky little widget logic -->
</td>
</tr>
<tr ng-repeat-end class="alertDetail">
<td></td>
<td colspan="5" ng-bind-html="alert.Details"></td>
</tr>
</tbody>
</table>
正如你所看到的,我目前基於濾波掉在我的數組的客戶名稱字段。但是,我想更改邏輯,以便可以使用單選按鈕在客戶名稱,主題,類型和日期之間進行選擇。因此,如果用戶單擊Date單選按鈕,則searchText將僅基於Date屬性進行過濾。獲得此功能的最佳方式是什麼?
你是聖人。非常感謝你 –