首页 > 其他 > 详细

ng-table

时间:2017-10-10 17:28:15      阅读:224      评论:0      收藏:0      [点我收藏+]

需要的文件:

  • angular.js
  • ng-table.js
  • ng-table.css
  • bootrasp.css

注入依赖:

 var app = angular.module(app, [
ngTableui.bootstrap,
]);

为ng-table设置数据

app.controller(controller, function($scope,NgTableParams) {
    $http.get("/query")
        .success(function(data) {
            $scope.userTable = new NgTableParams({
                        page : 1,
                        count : 5
                    }, {
                        total : data.length,
                        getData : data
                        }
                    }); 
            })
        });
}

为 table 添加 ng-table 属性

<table ng-table="userTable" class="table table-hover">
            <tbody>
                <tr>
                    <th>编号</th>
                    <th>用户名</th>
                </tr>
                <tr ng-repeat="user in $data">
                    <td>{{user.id}}</td>
                    <td>{{user.name}}</td>
                </tr>
            </tbody>
        </table>

 

ng-table

原文:http://www.cnblogs.com/avidya/p/7646708.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!