0

Hello I'm new to angularjs, I've got an issue while using Angularjs datatables downloaded from http://l-lin.github.io/angular-datatables/#/zeroConfig, getting error like TypeError: this.renderDataTableAndEmitEvent is not a function I've arranged the scripts in right order but getting the same issue even after it.

my angularjs code is

var myApp = angular.module('myApp', ['datatables']);
myApp.controller('AppCtrl', ['$scope', '$http', function($scope, $http) {
    $http.get('/contactlist').success(function(response){
        console.log(response);
        $scope.contactlist = response;
    });
}]);

following is my HTML code

<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myApp">
<script src="datatable/jquery.min.js"></script>
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/angular.min.js"></script>
<script src="datatable/angular-datatables.min.js"></script>
<link rel="stylesheet" href="datatable/datatables.min.css">
<script src="controllers/contactlistcontroller.js"></script>
<div class="container" ng-controller="AppCtrl">
<h1>Contact List App</h1>

<table width="100%" border="1" cellspacing="1" cellpadding="2" class="table" datatable="">
<thead>
  <tr>
    <td>Name</td>
    <td>Email</td>
    <td>Number</td>
    <td>Action</td>
    <td>&nbsp;</td>
  </tr>
  </thead>
   <tbody>
   <tr ng-repeat="contact in contactlist">
   <td>{{ contact.name}}</td>
   <td>{{ contact.email}}</td>
   <td>{{ contact.number}}</td>
   <td><button ng-click="remove(contact._id)" class="btn-danger">Remove</button></td>
   <td><button ng-click="edit(contact._id)" class="btn-warning">Edit</button></td>
   </tr>
   </tbody>
</table>
</div>
</html>

Iam able to print my data in table but datatables are not applying thanks in advance.

1 Answers1

0

you getting this error beacuse of "angular-datatables.min.js", replace this with new one and your error will get resolved.

ARaja
  • 1
  • 1