分页Html表

时间:2015-09-07 10:36:56

标签: html angularjs

我正在尝试创建一个表,当有超过10行时,我想创建一个超链接,告诉用户进入下一页。这个概念叫做分页,但我怎么能用AngularJS来实现呢?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Table</title>
        <style type="text/css">
            th {
                background-color: #ddd;
            }
            th td {
                 border: 1px solid black;
            }
        </style>
    </head>
    <body>
        <table>
            <th>Heading1</th>
            <th>Heading2</th>
            <tbody>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr><td>This is td</td><td>This is td</td></tr>
                <tr></tr>
            </tbody>
        </table>
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

<强> AngularUtils

尝试使用AngularUtils的分页指令here

他们的文档非常好,他们有关于如何使用Plunker here中的示例和演示的完整说明。

<div class="panel panel-default">
  <div class="panel-body">
    <ul>
      <li dir-paginate="meal in meals | filter:q | itemsPerPage: pageSize" current-page="currentPage">{{ meal }}</li>
    </ul>
  </div>
</div>