繁体   English   中英

用户单击按钮angular js时如何打开打印选项卡

[英]how to open print tab when user click button angular js

当用户单击链接时,我具有打印视图和控制器以打印结果:
<a data-ng-click="openPrintPreview(tab.countyID)">Employee List</a>

我想使用ng click打开打印预览窗口并显示打印控制器,但我的问题是查看当前页面' http:// localhost /#/ reception '而不是http:// localhost /#/ print / 2

$scope.openPrintPreview = function(countyId){
     var popupWin = window.open('', '_blank', 'width=800,height=700');
         popupWin.print('#/print/' + countyId);
};

这个怎么做

$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);
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM