$ elem.hide不是angular-datatable中的函数

Thu*_*thz 10 npm angularjs bower angular-datatables

我想使用分页插件angular-datatable.我用bower安装它但它不起作用.它给出了以下错误

TypeError:$ elem.hide不是postLink上的Object.showLoading(http:// localhost:8000/vendor/angular-datatables.js:698:15)中的函数(http:// localhost:8000/vendor/angular- datatables.js:47:31)在nodeLinkFn上的http:// localhost:8000/vendor/angular.js:8783:44 at invokeLinkFn(http:// localhost:8000/vendor/angular.js:8789:9)http:// localhost:8000/vendor/angular.js:8289:11)在compositeLinkFn(http:// localhost:8000/vendor/angular.js:7680:13)的compositeLinkFn(http:// localhost:8000 /) vendor/angular.js:7684:13)在compositeLinkFn(http:// localhost:8000/vendor/angular.js:7684:13)在compositeLinkFn(http:// localhost:8000/vendor/angular.js:7684:13)的compositeLinkFn(http:// localhost:8000 /) vendor/angular.js:7684:13)

我使用Zero配置,这是我使用的html代码

<table datatable="" class="row-border hover">
    <thead>
        <tr>
            <th>ID</th>
            <th>First name</th>
            <th>Last name</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>Foo</td>
            <td>Bar</td>
        </tr>
        <tr>
            <td>123</td>
            <td>Someone</td>
            <td>Youknow</td>
        </tr>
        <tr>
            <td>987</td>
            <td>Iamout</td>
            <td>Ofinspiration</td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

K.T*_*ess 24

我认为你javascript错误地添加了文件.

你需要按此顺序添加

  1. JQUERY
  2. ANGULAR
  3. JQUERY数据表
  4. 角数据表

并且不要忘记将datatables模块添加到主模块中,

EX: angular.module('plunker', ['datatables']);

DEMO

简单 - 如果你添加jquery.js之后angular.js,然后剪切jquery.js并将其放在顶部angular.js.

如果您正在使用,bower则更新bower.json以满足上述更改.