簡體   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