用Bootstrap样式化Angular-Datatable

时间:2019-04-26 19:58:57

标签: angular angular-datatables

我正在尝试使Bootstrap这样的Angular-Datatable(https://l-lin.github.io/angular-datatables/)样式。因此,我的angular.json文件中包含以下内容:

 "styles": [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.css",
              "node_modules/datatables.net-bs/css/dataTables.bootstrap.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.slim.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.min.js",
              "node_modules/popper.js/dist/umd/popper.js",
              "node_modules/datatables.net/js/jquery.dataTables.js",
              "node_modules/datatables.net-bs/js/dataTables.bootstrap.js"
            ]

但是我的数据表如下:

enter image description here

我的项目可以在GitHub中找到:https://github.com/rlanhellas/together-admin

1 个答案:

答案 0 :(得分:1)

我必须将它们添加到index.html的底部,以使引导样式适用于数据表:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" 
type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js" 
type="text/javascript"></script> 
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js" 
type="text/javascript"></script>