![](/img/trans.png)
[英]How to trigger jquery “click” event even when the user clicked “middle button” or right click -> open in a new tab
[英]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.