简体   繁体   中英

Table pagination in angular 2

I have been trying to implement table pagination for my html table in angular 2 but it doesn't work out for me. I have although included the scripts in my angular-cli.json file. What am i not doing right?

  <script>

            $(document).ready(function() {
                $('#foodTable').DataTable();
            } );


        </script>

        <script src="../foodlist/js/pagination1.js"></script>
        <script src="../foodlist/js/pagination2.js"></script>
        <script src="../foodlist/js/pagination3.js"></script>

<table  class="table" id="foodTable"  >
</table>

You should't use jQuery or load any any those JavaScript files. You can do all of this with angular itself there are a lot great modules for pagination out there with great documentation.

http://valor-software.com/ng2-table/

http://michaelbromley.github.io/ng2-pagination/#/

These two are used in a lot of applications and have great documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM