<commit_before><!DOCTYPE html>
<html lang="en" ng-app="zfpxMod">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div class="container" ng-controller="zfpxCtrl">
    <div class="row">
        <div class="col-md-8">
            <table class="table table-border">
                <tr>
                    <td>当前页码</td>
                    <td><input type="text" ng-model="pageNumber"></td>
                </tr>
                <tr>
                    <td>每页条数</td>
                    <td><input type="text" ng-model="pageSize"></td>
                </tr>
                <tr>
                    <td>过滤条件</td>
                    <td>
                        按名称过滤:<input type="text" ng-model="search.name"><br/>
                        按年龄过滤:<input type="text" ng-model="search.age"><br/>
                        过滤有字段:<input type="text" ng-model="search.$">
                    </td>
                </tr>
                <tr>
                    <td>排序字段</td>
                    <td>
                        <select ng-model="or">
                            <option value="name">姓名升序</option>
                            <option value="-name">姓名降序</option>
                            <option value="age">年龄升序</option>
                            <option value="-age">年龄降序</option>
                        </select>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-border">
                <tr>
                    <td>ID</td>
                    <td>姓名</td>
                    <td>年龄</td>
                </tr>
                <tr ng-repeat="user in users|filter:search|orderBy:or|pager:pageNumber:pageSize">
                    <td>{{user.id}}</td>
                    <td>{{user.name}}</td>
                    <td>{{user.age}}</td>
                </tr>
            </table>
            <nav>
                <ul class="pagination">
                    <li ng-if="pageNumber>1" ng-click="go(pageNumber -1)">
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li ng-class="{active:pageNumber == page}"  ng-click="go(page)" ng-repeat="page in pages"><a href="#">{{page}}</a></li>
                    <li ng-if="pageNumber<totalPage"  ng-click="go(pageNumber +1)">
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>
<script src="angular.min.js"></script>
<script>
    angular.module('zfpxMod',[]);
    angular.module('zfpxMod').filter('pager',function(){
        return function(input,pageNum,pageSize){
            // 1 0,2
            // 2 2,4
            return input.slice((pageNum-1)*pageSize,pageNum*pageSize);
        }
    });
    angular.module('zfpxMod').controller('zfpxCtrl',function($scope){
        $scope.go = function(page){
            $scope.pageNumber = page;
        }
        $scope.pageNumber = 1;
        $scope.pageSize = 2;
        $scope.users = [
            {id:1,name:'1',age:4},
            {id:2,name:'2',age:3},
            {id:3,name:'3',age:2},
            {id:4,name:'4',age:1}
        ]
        $scope.pages = [];//存放一共有多少页
        //先算出总页数
        $scope.totalPage = Math.ceil($scope.users.length/$scope.pageSize);

        for(var i=0;i<$scope.totalPage;i++){
            $scope.pages.push(i+1);
        }
    });
</script>
</html><commit_msg>页签 切换效果<commit_after><!DOCTYPE html>
<html lang="en" ng-app="zfpxMod">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div class="container" ng-controller="zfpxCtrl">
    <div class="row">
        <div class="col-md-8">
            <table class="table table-border">
                <tr>
                    <td>当前页码</td>
                    <td><input type="text" ng-model="pageNumber"></td>
                </tr>
                <tr>
                    <td>每页条数</td>
                    <td><input type="text" ng-model="pageSize"></td>
                </tr>
                <tr>
                    <td>过滤条件</td>
                    <td>
                        按名称过滤:<input type="text" ng-model="search.name"><br/>
                        按年龄过滤:<input type="text" ng-model="search.age"><br/>
                        过滤有字段:<input type="text" ng-model="search.$">
                    </td>
                </tr>
                <tr>
                    <td>排序字段</td>
                    <td>
                        <select ng-model="or">
                            <option value="name">姓名升序</option>
                            <option value="-name">姓名降序</option>
                            <option value="age">年龄升序</option>
                            <option value="-age">年龄降序</option>
                        </select>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    {{pages}}
    {{totalPage}}
    <div class="row">
        <div class="col-md-12">
            <table class="table table-border">
                <tr>
                    <td>ID</td>
                    <td>姓名</td>
                    <td>年龄</td>
                </tr>
                <tr ng-repeat="user in users|filter:search|orderBy:or|pager:pageNumber:pageSize">
                    <td>{{user.id}}</td>
                    <td>{{user.name}}</td>
                    <td>{{user.age}}</td>
                </tr>
            </table>

            <nav>
                <ul class="pagination">
                    <li ng-if="pageNumber>1" ng-click="go(pageNumber -1)">
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li ng-class="{active:pageNumber == page}"  ng-click="go(page)" ng-repeat="page in pages()"><a href="#">{{page}}</a></li>
                    <li ng-if="pageNumber<totalPage"  ng-click="go(pageNumber +1)">
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>
<script src="angular.min.js"></script>
<script>
    angular.module('zfpxMod',[]);
    angular.module('zfpxMod').filter('pager',function(){
        return function(input,pageNum,pageSize){
            // 1 0,2
            // 2 2,4
            return input.slice((pageNum-1)*pageSize,pageNum*pageSize);
        }
    });
    angular.module('zfpxMod').controller('zfpxCtrl',function($scope,$filter){
        $scope.go = function(page){
            $scope.pageNumber = page;
        }
        $scope.pageNumber = 1;
        $scope.pageSize = 2;
        $scope.users = [
            {id:1,name:'1',age:4},
            {id:2,name:'2',age:3},
            {id:3,name:'3',age:2},
            {id:4,name:'4',age:1}
        ]
        //监听模型上 $scope的pageSize属性的变化
        //变化之后执行对应的回调

        $scope.pages = function(){
            var _pages = [];//存放一共有多少页
            //先算出总页数
            //$filter('pager')
            var fitleredUser = $filter('filter')($scope.users,$scope.search);
            console.log(fitleredUser);
            $scope.totalPage = Math.ceil(fitleredUser
.length/$scope.pageSize);

            for(var i=0;i<$scope.totalPage;i++){
                _pages.push(i+1);
            }
            return _pages;
        }
       /* $scope.$watch('pageSize',function(){
            $scope.pages = [];//存放一共有多少页
            //先算出总页数
            $scope.totalPage = Math.ceil($scope.users.length/$scope.pageSize);

            for(var i=0;i<$scope.totalPage;i++){
                $scope.pages.push(i+1);
            }
        });*/


    });
</script>
</html>
{'fraction_non_alphanumeric': 0.17438196800775568, 'fraction_numerical': 0.008240426563257392, 'mean_word_length': 1.2420537897310513, 'pattern_counts': {'":': 0, '<': 220, '<?xml version=': 0, '>': 217, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '876917', 'n_tokens_mistral': 2649, 'n_tokens_neox': 2574, 'n_words': 357}