TypeError:_parentScope。$ watchCollection不是Angular函数 - 数据表

时间:2016-12-08 17:10:50

标签: angularjs datatables angular-directive angular-datatables

尝试加载Angular-datatable时出现此错误。

包括:

<script src="//code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-datatables/0.5.5/angular-datatables.js"></script>

错误:

angular.min.js:63 TypeError: _parentScope.$watchCollection is not a function
    at Object.render (angular-datatables.js:901)
    at angular-datatables.js:124
    at h (angular.min.js:78)
    at angular.min.js:78
    at Object.$eval (angular.min.js:89)
    at Object.$digest (angular.min.js:86)
    at Object.$apply (angular.min.js:89)
    at angular.min.js:16
    at Object.d [as invoke] (angular.min.js:28)
    at c (angular.min.js:16)(anonymous function) @ angular.min.js:63

1 个答案:

答案 0 :(得分:1)

angular 1.0.8不支持$ watchCollection。 尝试更新angularjs脚本: 这里是角度的最终稳定版本:

    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>