diff --git a/src/lib/ngx-print.directive.ts b/src/lib/ngx-print.directive.ts index beccd1f..7e75aad 100644 --- a/src/lib/ngx-print.directive.ts +++ b/src/lib/ngx-print.directive.ts @@ -155,10 +155,12 @@ public returnStyleValues() { function triggerPrint(event) { window.removeEventListener('load', triggerPrint, false); setTimeout(function() { - window.print(); - setTimeout(function() { window.close(); }, 0); + closeWindow(window.print()); }, ${this.printDelay}); } + function closeWindow(){ + window.close(); + } window.addEventListener('load', triggerPrint, false);