当前位置: 首页 > 工具软件 > angular-split > 使用案例 >

angular-年龄查询

王兴庆
2023-12-01
$scope.ageTest = function (age, ageSize) {
    if (ageSize != "--请选择--") {
        var agess = ageSize.split("-");
        var ageMin = agess[0];
        var ageMax = agess[1];
        if (age < ageMin || age > ageMax) {
            return false;
        } else {
            return true;
        }
    } else {
        return true;
    }
}
//html代码
<select id="age" ng-model="ageSize" ng-init="ageSize='--请选择--'">
    <option>--请选择--</option>
    <option>11-20</option>
    <option>21-30</option>
    <option>31-40</option>
    <option>41-50</option>
    <option>51-60</option>
</select>
<tr>
    <td><input type="checkbox" ng-click="checkAll()" ng-model="chec"></td>
    <th align="left"  ng-click="dian('id')">id</th>
    <th  ng-click="dian('name')">用户名</th>
    <th  ng-click="dian('password')">密码</th>
    <th  ng-click="dian('age')">年龄</th>
    <th  ng-click="dian('sex')">性别</th>
    <th>操作</th>
</tr>
    <tr ng-repeat="x in shuzu|filter:{'Name':search}" ng-if="ageTest(x.age,ageSize)">
        <td><input type="checkbox" ng-model="x.done" ng-click="counts()"></td>
        <td>{{x.id}}</td>
        <td>{{x.Name}}</td>
        <td>{{x.password}}</td>
        <td>{{x.age}}</td>
        <td>{{x.sex}}</td>
        <td>
            <button ng-click="editUser($index)">修改密码</button>
        </td>
    </tr>

 类似资料: