Javascript 如何在angularjs中使用selectbox进行搜索
我有东西在角度上正常工作Javascript 如何在angularjs中使用selectbox进行搜索,javascript,angularjs,Javascript,Angularjs,我有东西在角度上正常工作 Any: <input ng-model="search.$"> Student Name only <input ng-model="search.number"> student Region only <input ng-model="search.region"> 还有这个 <li ng:repeat="students in student | filter:search" > 但我想把
Any: <input ng-model="search.$">
Student Name only <input ng-model="search.number">
student Region only <input ng-model="search.region">
还有这个
<li ng:repeat="students in student | filter:search" >
但我想把这三个搜索框变成一个搜索框,然后像这样选择框
Any: <input ng-model="search.$">
<select>
<option value="number">Student Number</option>
<option value="region">Student Region</option>
</select>
此外,我想执行搜索时,用户点击搜索按钮
我该怎么做当用户点击按钮时,您可以设置搜索值。
活样本:
模板:
<label>
Search Value: <input ng-model="filter">*emphasized text*
</label><br>
<label>
Search Key:
<select ng-model="key">
<option value="$">Any</option>
<option value="number">Student Number</option>
<option value="region">Student Region</option>
</select>
</label>
<button ng-click="setfilter()">search</button>
$scope.setfilter = function() {
$scope.search = {};
$scope.search[ $scope.key ] = $scope.filter;
console.log( $scope.search );
};