我似乎无法让它工作,我正在尝试根据 ui-select 创建的数组进行过滤。
看法:
<tbody>
<tr ng-repeat="project in projects | filter: filterstring | filter: filteredSkills.skills">
<td>{{project.Title}}</td>
<td>{{project.Offers}}</td>
<td>{{project.Skills}}</td>
<td>{{project.Budget}}</td>
<td>{{project.Posted|timeago}}</td>
</tr>
</tbody>
控制器:
app.controller("projectListController", ['$scope', 'Poller', '$timeout',
function($scope, Poller, $timeout) {
$scope.projects = Poller.projects;
$scope.availableColors = [
'PHP',
'0',
'New Project',
'$30-$250',
'10 days ago'
];
$scope.filteredSkills = {};
}]);
两种模型的 HTML:
<div class="col-md-5">
<label for="filterstring">Search:</label>
<input type="text" ng-model="filterstring" />
</div>
<ui-select multiple ng-model="filteredSkills.skills" theme="select2" ng-disabled="disabled" style="width:100%;">
<ui-select-match placeholder="Select Skills...">{{$item}}</ui-select-match>
<ui-select-choices repeat="color in availableColors | filter:$select.search">
{{color}}
</ui-select-choices>
</ui-select>
两个请求都添加了 HTML。