У меня есть таблица, в которой отображается список транзакций, теперь я хочу напечатать только одну конкретную строку, для этого я использовал функцию printToCart
и передал элементы в этой строке, а также данные, переданные и присвоенные $scope.printValues
, ночто значения не передаются в моем html, я имею в виду не может быть просмотрен в html.
JS:
$scope.printToCart = function(printSectionId,item) {
$scope.printValues = item;
var innerContents = document.getElementById(printSectionId).innerHTML;
var popupWindow = window.open('', '_blank', 'width=900,height=800,scrollbars=no,menubar=no,toolbar=no,location=no,status=no,titlebar=no');
popupWindow.document.open();
$scope.datagetinLoading = false; $('#preparingToSaveInvoice').modal('hide');
$('#preparingToPrintInvoice').modal('hide');
$('#preparingToDownloadPDF').modal('hide');
$('#printReceiptDetailsWaiting').modal('hide');
popupWindow.document.write('<html><head><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic"><body onload="window.print()"><style>#footer { position:relative; bottom:0; width:100%; height: auto; } #header { display: flow-root; height: auto; border-bottom: 1px solid #333;} </style><div class="wrapper" style="padding-right: 10px;">' + innerContents + '</div></body></html>');
popupWindow.document.close();
};
Печать HTML:
<div id="printquotationPreview" hidden>
<div>
<table class="table table-responsive"
<tbody>
<tr><td><div><img src="assets/img/logo.png">
<p> INVOICE</p> </div></td></tr>
</tbody>
</table>
</div>
<br>
<div class="row col-sm-12">
<div>
<table class="table table-hover">
<thead>
<tr>
<th>SL.NO</th>
<th>DESCRIPTION</th>
<th>AMOUNT</th>
</tr>
</thead>
<tbody>
<tr class="table-row">
<td >1</td>
<td>Credit Purchase {{printValues.credits}}</td>
<td>{{printValues.cost}}</td>
</tr>
</tbody>
</table>
</div>