html代码:
<select class="choose_time_begin_month" ng-model="filter_begin_month"> <option value="">开始月份</option><option value="1">01</option> <option value="2">02</option><option value="3">03</option><option value="4">04</option> <option value="5">05</option><option value="6">06</option> <option value="7">07</option><option value="8">08</option> <option value="9">09</option><option value="10">10</option> <option value="11">11</option><option value="12">12</option> </select> - <select class="choose_time_end_month" ng-model="filter_end_month"> <option value="">结束月份</option> <option value="1">01</option><option value="2">02</option><option value="3">03</option> <option value="4">04</option><option value="5">05</option><option value="6">06</option> <option value="7">07</option><option value="8">08</option><option value="9">09</option> <option value="10">10</option><option value="11">11</option><option value="12">12</option> </select>|filter:{ah:ztsearch}(ah为变量) JavaScript代码:$scope.filterByMonth = function (user) { if ($scope.filter_begin_month == undefined || $scope.filter_begin_month == "") { return true; } if ($scope.filter_end_month == undefined || $scope.filter_end_month == "") { return true; } if ($scope.filter_begin_month > $scope.filter_end_month) { return true; } var month = user.xiatime.substr(0, user.xiatime.indexOf("-")); month = parseInt(month); return (month >= $scope.filter_begin_month && month <= $scope.filter_end_month); };