简体   繁体   中英

Tslint Angular: Usage of window is not allowed

I need to print one of the pages in my Angular app, so I have something like:

myPage = window.open();
myPage.Print();

The thing is that I get the following error from tslint:

"Usage of window is not allowed"

I looked of some answeres here / other solutions, for example: https://brianflove.com/2018/01/11/angular-window-provider/

but they all use at some point window

 return window;

and then I'll get the error messge "Usage of window is not allowed" again.

How can I solve it ?

Thanks.

So I resolved it by instead of do myPage = window.open(); , just do:

myPage = open(); 

instead ...

pretty much so easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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