Step 1

First we have to create a table and mention print option button in the above table. Please refer to the below code for table and print options button.

  1. <button type="button" class="btn btn-success" ng-click="PrintRecord()">
  2. <i class="fa fa-download"></i>Print</button>

Step 2

Just mention click event in print options button. The click event name is ng-click="PrintRecord()".

Step 3

Refer to the table id; the table id name is id="tablerecords".

  1. <div class="panel-body">
  2. <table role="grid" id="tablerecords">
  3. <thead class="k-grid-header" role="rowgroup">
  4. <tr role="row">
  5. <th>S.No</th>
  6. <th>Name</th>
  7. <th>Email</th>
  8. <th>Mobile Number</th>
  9. </tr>
  10. </thead>
  11. <tbody role="rowgroup">
  12. <tr ng-repeat="user in UsersList class=" trstyle ">
  13. <td><strong>{{$index+1}}</strong> <td>
  14. <td><strong>{{user.Name}}</strong></td>
  15. <td><strong>{{user.Email}}</strong></td>
  16. <td><strong>{{user.MobileNumber}}</strong></td>
  17. </tbody>
  18. </table>
  19. </div>

Step 4

The click event has been triggered and gets table records value to throw print option page. Just put this code in your js page .

Here click event pass printData function and printData function has to get table records to just proceed to print page.

  1. $scope.PrintRecord = function() {
  2. printData();
  3. }
  4. function printData() {
  5. var divToPrint = document.getElementById("tablerecords");
  6. newWin = window.open("");
  7. newWin.document.write(divToPrint.outerHTML);
  8. newWin.print();
  9. newWin.close();
  10. }