gsk gsk - 11 days ago 7
AngularJS Question

Datatable with angularJs shows no data error?

I want to use datatable in angularjs. I have written directives and data table initializing and displaying rows in table first time.
When searching or filtering,it shows no data in table error message.

Directive code is

"use strict";
invoiceApp.directive('itemTable', function () {
return {
restrict: 'E',
replace: true,
templateUrl: 'app/components/item/item_table.html',
link: function (scope, table) {


Template is,

<table my-table id="dt_basic" class="table table-bordered table-hover" width="100%">
<th class="text-center" width="10">
<input type="checkbox" name="checkbox-inline" id="slt_all">
<th data-class="expand">Name</th>
<th data-hide="phone">Description</th>
<th data-hide="phone">Unit</th>
<tr ng-repeat="item in items">
<td class="text-center"><input type="checkbox" checked="checked" name="checkbox-inline"></td>
<td>AED {{item.rate}}</td>

Controller is,

'use strict';
invoiceApp.controller('itemController', ['$scope', 'ItemService', function ($scope, ItemService) {
$scope.items = //datas

enter image description here
Why it happening ?


Instead of creating new directive, simply add datatable=" using this angular datatable module


<table datatable="" class="row-border hover">
        <th>First name</th>
        <th>Last name</th>

JS :

angular.module('showcase', ['datatables']);

More detail AngularJs Datatable and Download