Angular 2 opening a static page

南楼画角 提交于 2019-12-05 18:32:39

You could try and leverage the name parameter of the window.open() method which is the equivalent of the target attribute in anchor tags.

window.open("help/index.html", "_blank");

working Plunker example

The way that I got around the error is to wrap the window.open in a timeout. This allows for the window open to run after the angular code finishes. Normally you don't want to use timeouts inside of your app but since this is opening a new window at a new location that won't use the same instance of your app it should be okay.

setTimeout(() => {
  window.open("./README.md", "_blank");
});

Working Plunker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!