<script src= "Https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type= "Text/javascript" ></ Script>
<div ng-controller= "Myctrl" >
<button ng-click= "ExportData ()" >Export</button>
<br/>
<div id= "exportable" >
<table width= "100%" >
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>DoB</th>
</tr>
</thead>
<tbody>
<TR ng-repeat= "Item in Items" >
<td>{{item.name}}</td>
<td>{{item.email}}</td>
<td>{{item.dob | date: ' MM/DD/YY '}}</td>
</tr>
</tbody>
</table>
</div>
</div>
function Myctrl ($scope) {
$scope. ExportData = function () {
var blob = new Blob ([document.getElementById (' exportable '). InnerHTML], {
Type: "Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
SaveAs (BLOB, "Report.xls");
};
$scope. Items = [{
Name: "John Smith",
Email: "[email protected]",
DOB: "1985-10-10"
}, {
Name: "Jane Smith",
Email: "[email protected]",
DOB: "1988-12-22"
}, {
Name: "Jan Smith",
Email: "[email protected]",
DOB: "2010-01-02"
}, {
Name: "Jake Smith",
Email: "[email protected]",
DOB: "2009-03-21"
}, {
Name: "Josh Smith",
Email: "[email protected]",
DOB: "2011-12-12"
}, {
Name: "Jessie Smith",
Email: "[email protected]",
DOB: "2004-10-12"
}]
}
Browser-side JS export excel--001