我需要在分页的ng-repeat中打印所有值。
我已尝试过此功能,但它只是在屏幕上打印所有内容,并且不会在第1页之后打印分页值。我还尝试创建一个单独的html文件,仅用于打印,但我不会这样做。知道如何将数据传递到单独的页面。
function printResults(id) {
var contents = $("#" + id).html();
if ($("#printDiv").length == 0) {
var printDiv = null;
printDiv = document.createElement('div');
printDiv.setAttribute('id', 'printDiv');
printDiv.setAttribute('class', 'printable');
$(printDiv).appendTo('body');
}
$("#printDiv").html(contents);
window.print();
$("#printDiv").remove();
}
div我试图打印:
<div id="printMe" class="provider" ng-repeat="provider in vm.filteredProviders">
<p class="provider-header">{{provider.header}}</p>
<div class="row">
<div class="col-xs-6">
<p>{{provider.providerGroupName}}</p>
<p>{{provider.city}}, {{provider.state}} {{provider.zipCode}}</p>
<p>{{provider.phone}}</p>
</div>
<div class="col-xs-6">
<p><strong>Specialties</strong></p>
<p>
<span ng-repeat="specialty in provider.specialties">
{{specialty}}
</span>
</p>
</div>
<div class="col-xs-6">
<p><strong>Language(s):</strong></p>
<p>
<span ng-repeat="language in provider.languages">
{{language}}
</span>
</p>
</div>
<div class="col-xs-6 pull-right">
<p><strong>Network</strong></p>
<p>{{provider.providerNetwork}}</p>
</div>
<div class="col-xs-6 pull-left">
<p><strong>Accepting New Patients</strong></p>
<p>{{provider.acceptingNewPatients ? 'Yes' : 'No'}}</p>
</div>
</div>
<hr />
</div>
<ul class="non-printable" uib-pagination total-items="vm.totalItems" items-per-page="vm.itemsPerPage"
max-size="vm.maxSize" force-ellipses="true" boundary-link-numbers="true" ng-disabled="vm.isPrinting"
ng-model="vm.currentPage" ng-change="vm.pageChanged()" ng-show="vm.providers.length > 0">
</ul>