当用户点击链接时,我有打印视图和控制器来打印结果:
<a data-ng-click="openPrintPreview(tab.countyID)">Employee List</a>
我想使用ng点击打开打印预览窗口并显示打印控制器,但我的问题是查看当前页面&#39; http://localhost/#/reception&#39;不是http://localhost/#/print/2
$scope.openPrintPreview = function(countyId){
var popupWin = window.open('', '_blank', 'width=800,height=700');
popupWin.print('#/print/' + countyId);
};
答案 0 :(得分:0)
这是怎么做的
$scope.openPrintPreview = function(countyId) {
var printUrl = window.location.origin + '/#/print/' + countyId;
var popupWin = window.open(printUrl.toString(), '_blank', 'width=800,height=700');
setTimeout(function () {
popupWin.print();
}, 1000);
};