how to use angular js datatable with export buttons

Multi tool use
how to use angular js datatable with export buttons
dataTables.buttons.min.js:5 Uncaught TypeError: Cannot read property 'ext' of undefined
at dataTables.buttons.min.js:5
at dataTables.buttons.min.js:5
at dataTables.buttons.min.js:5
I am getting this type of error if i try to place button extensions CDN in angular Js please help me to solve the issue.
1 Answer
1
Add your datatables dependecies
<!-- Datatables -->
<link href="path to/datatables.min.css" rel="stylesheet">
http://path%20to/datatables.min.js
<!-- Datatables Buttons -->
http://path%20to/dataTables.buttons.min.js
<!-- Angular Datatables -->
http://path%20to/angular-datatables.min.js
http://path%20to/angular-datatables.buttons.min.js
Include angular datatables in your module
angular
.module('app', [
'datatables',
'datatables.buttons'
])
Inject DTOptionsBuilder and define the options in your controller
angular
.module('app')
.controller('MyController', function MyController($scope, DTOptionsBuilder) {
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withButtons([
'copy',
'pdf',
'excel'
])
.withDOM('<"html5buttons"B>lTtipr');
});
Declare datatables and dt-options directive on your table
<table datatable="ng" dt-options="dtOptions" class="table table-striped table-bordered"></table>
Angular Datatables docs: http://l-lin.github.io/angular-datatables/archives/#!/withButtons
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.