apollodec/Apollo/assets/js/directives/table-export.js
2018-08-16 18:06:21 +05:30

44 lines
1014 B
JavaScript

// 'use strict';
// /**
// * Prevent default action on empty links.
// */
// app.directive('a', function () {
// return {
// restrict: 'E',
// link: function (scope, elem, attrs) {
// if (attrs.ngClick || attrs.href === '' || attrs.href === '#') {
// elem.on('click', function (e) {
// e.preventDefault();
// });
// }
// }
// };
// });
(function(){
// alert();
//export html table to pdf, excel and doc format directive
var exportTable = function(){;
var link = function($scope, elm, attr){
$scope.$on('export-pdf', function(e, d){
elm.tableExport({type:'pdf', escape:false});
});
$scope.$on('export-excel', function(e, d){
alert();
elm.tableExport({type:'excel', escape:false});
});
$scope.$on('export-doc', function(e, d){
elm.tableExport({type: 'doc', escape:false});
});
}
return {
restrict: 'C',
link: link
}
}
app
.directive('exportTable', exportTable);
})();