Angular -datatables error - undefined is not a function

I am creating a report with angular datatables. When I execute my page, I get an error in the angular.js file stating that undefined is not a function along with other code:

 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">

Here is my angular function building my table:

 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)

}());

Finally, here is my 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>

I'm not sure if I missed something or something was wrong. As far as I know, I have everything I need to work with data. When I run my page, the data data is loaded enough to show the boot part and then errors. Thank you

+4
source share
1 answer

I assume you are using v0.1.1.

, , Angular jQuery, jqlite. jQuery datatables, 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>
+6

Source: https://habr.com/ru/post/1570222/


All Articles