0
我正在使用Angular 4. HostListener似乎不支持window.onbeforeprint事件處理程序。對於chrome,我能夠在HostListener之外爲window.matchMedia('print')添加一個偵聽器。但是這對IE和Firefox不起作用。什麼是window.onbeforeprint工作在角4Angular4打印處理程序
@HostListener('window:onbeforeprint',['$event'])
onBeforePrint(event){
console.log('Before print');
}
https://plnkr.co/edit/4ZdLNklitwsucH0X6Azv