10

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

TypeError: $elem.hide is not a function at Object.showLoading ( http://localhost:8000/vendor/angular-datatables.js:698:15 ) at postLink ( http://localhost:8000/vendor/angular- datatables.js:47:31 ) 在http://localhost:8000/vendor/angular.js:8783:44 在 invokeLinkFn ( http://localhost:8000/vendor/angular.js:8789:9 ) 在 nodeLinkFn ( 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/供应商/angular.js:7684:13 )

我使用零配置,这是我使用的 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>

4

2 回答 2

25

我认为您javascript以错误的顺序添加文件。

您需要按此顺序添加

  1. 查询
  2. 角度
  3. JQUERY 数据表
  4. 角度数据表

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

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

演示

简单 - 如果您在jquery.js之后添加angular.js,则剪切jquery.js并将其放在angular.js.

如果您正在使用bower然后更新bower.json以满足上述更改。

于 2015-10-23T10:46:13.493 回答
1

另外,请确保您没有将ng-jq指令设置为空。相反,您想将其设置为$orjQuery

<html id="ng-app" ng-jq="$">

或者

<html id="ng-app" ng-jq="jQuery">
于 2016-08-24T07:06:09.457 回答