Exporting ng-grid data to CSV and PDF format

I have created one grid using ng-grid in angularjs . i would like to add functionality of exporting grid data to CSV and PDF format.Is there a plug in available for that in angularjs? if not , then could anyone suggest me the way to achieve it?.

There is a plugin for Angular-Grid that allows this, but the authors warn that it's mostly a proof of concept at this point:

https://raw.githubusercontent.com/duro/my-angular-requiejs-example/master/vendor/angular-ui-ng-grid/plugins/ng-grid-csv-export.js

After loading the code from the above repository, you can add the following line to your grid's configuration:

plugins: [new ngGridCsvExportPlugin()],
showFooter: true

Be sure to have your ng-grid's footer turned on or you won't see the link.

showFooter: true

Also, I am using jQueryUI and I got the link to show up much prettier with this:

//var csvDataLinkHtml = "<div class=\"csv-data-link-span\">";
//csvDataLinkHtml += "<a href=\"data:text/csv;charset=UTF-8,";
//csvDataLinkHtml += encodeURIComponent(csvData);
//csvDataLinkHtml += "\" download=\"Export.csv\">Export to Excel</a></div>" ;

var csvDataLinkHtml = "<a style='float:right;margin:10px;' class=\"csv-data-link-span btn btn-primary\" href=\"data:text/csv;charset=UTF-8,";
csvDataLinkHtml += encodeURIComponent(csvData);
csvDataLinkHtml += "\" download=\"Export.csv\">Export to Excel</a>" ;