Angular 2打开静态页面 [英] Angular 2 opening a static page

查看:93
本文介绍了Angular 2打开静态页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有angular 2项目.我想在新窗口中打开服务器上可用的静态帮助文件.我尝试了window.open(help/index.html). 它导航到页面,但引发有关找不到路由的错误. 我也尝试在角度区域外运行以上代码,但没有区别. 我怀疑浏览器位置更改时,角度会在下一个更改检测周期中检测到它,然后尝试路由到该URL. 为达到此目的可以采取什么措施.

I have angular 2 project. I want to open static help files available on server in new window. I tried window.open(help/index.html). It navigates to the page but throws error about route not found. I have also tried to run above code outside angular zone but makes no difference. I suspect as browser location changes angular detects it in next change detection cycle and try to route to that URL. What could be done to achieve this.

推荐答案

您可以尝试利用name参数. rel ="nofollow"> window.open() 方法,相当于锚标记中的target属性.

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");


正在工作柱塞示例

这篇关于Angular 2打开静态页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆