gpt4 book ai didi

angularjs - Angular 数据表错误 - 未定义不是函数

转载 作者:行者123 更新时间:2023-12-05 00:23:43 26 4
gpt4 key购买 nike

我正在使用 Angular 数据表构建报告。当我执行我的页面时,我的 angular.js 文件中出现一个错误,指出 undefined 不是一个函数以及一些其他代码:

 TypeError: undefined is not a function
at Object._showLoading [as showLoading] (http://localhost:55823/Scripts/angular-datatables/angular-datatables.renderer.js:8:23)
at showLoading (http://localhost:55823/Scripts/angular-datatables/angular-datatables.directive.js:25:39)
at postLink (http://localhost:55823/Scripts/angular-datatables/angular-datatables.directive.js:17:26)
at http://localhost:55823/Scripts/angular-1.2.19/angular.js:7050:44
at nodeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6648:13)
at compositeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6039:13)
at nodeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6642:24)
at compositeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6039:13)
at compositeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6042:13)
at compositeLinkFn (http://localhost:55823/Scripts/angular-1.2.19/angular.js:6042:13) <table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="row-border hover datatable ng-isolate-scope">

这是我构建表格的 Angular 函数:
 var manageBackOrdersApp = angular.module('manageBackOrdersApp', ['sharedApp',  'datatables']);

(function () {

var manageBackOrdersController = function ($scope, $http, DTOptionsBuilder, DTColumnBuilder) {
$scope.dtOptions = DTOptionsBuilder.fromSource('/Customer/ManageBackOrders/firstJson')
.withPaginationType('full_numbers').withDisplayLength('1000');
$scope.dtColumns = [
DTColumnBuilder.newColumn('CustID').withTitle('Cust ID')
.renderWith(function(data, type, full, meta) {
return '<a target="_blank" href="gmail.com">' + full.CustID + '</a>'
}),
DTColumnBuilder.newColumn('SOID').withTitle('SO ID')
.renderWith(function(data, type, full, meta) {
return '<a target="_blank" href="gmail.com">' + full.SOID + '</a>'
}),
DTColumnBuilder.newColumn('CreateDate').withTitle('SO Date'),
DTColumnBuilder.newColumn('SPerName').withTitle('Sales Rep'),
DTColumnBuilder.newColumn('ItemID').withTitle('Item')
.renderWith(function (data, type, full, meta) {
return '<a target="_blank" href="gmail.com">' + full.ItemID + '</a>'
}),
DTColumnBuilder.newColumn('CurWhseID').withTitle('Cur Whse'),
DTColumnBuilder.newColumn('QtyOnBO').withTitle('QtyOnBO'),
DTColumnBuilder.newColumn('WhseID').withTitle('Avail Whse'),
DTColumnBuilder.newColumn('QtyAvail').withTitle('Qty Avail'),
DTColumnBuilder.newColumn('ShipMethDesc').withTitle('Ship Via'),
DTColumnBuilder.newColumn('HoldReason').withTitle('Comments')
];

}

manageBackOrdersController.$inject = ['$scope', '$http', 'DTOptionsBuilder', 'DTColumnBuilder'];

angular.module('manageBackOrdersApp').controller('manageBackOrdersController', manageBackOrdersController)

}());

最后,这是我的html:
<div ng-controller="manageBackOrdersController">
<div class="dataTable_top">
<br class="clearit" />
</div>
<table datatable="" dt-options="dtOptions" dt-columns="dtColumns" class="row-border hover datatable"></table>
</div>

我不确定我是否遗漏了什么或有什么问题。据我所知,我拥有数据表工作所需的所有内容。当我运行我的页面时,数据表加载到足以显示加载部分,然后出错。谢谢。

最佳答案

我猜你正在使用 v0.1.1。

我认为问题来自这样一个事实,即 Angular 不使用 jQuery,而是使用它的 jqlite。
您需要先包含 jQuery 和数据表,然后是 Angular,最后是 angular-datatables:

<script src="jquery.min.js"></script>
<script src="jquery.dataTables.min.js"></script>
<script src="angular.min.js"></script>
<script src="angular-datatables.min.js"></script>

关于angularjs - Angular 数据表错误 - 未定义不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27808231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com