有什么方法可以从内部 html (angular 6) 在新标签页中打开 link
Is there any way to open link in anew tab from inner html (angular 6)
我有一个带有内部 html 的 span 标签,就像这样
在我的 html 中:
<span [innerHTML]="description"></span>
在我的 ts 中:
description = "some random text https://whosebug.com/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"
它显示 link 但是当我点击它时 link 它在同一个选项卡中打开,但我希望它在新选项卡中打开。
有什么办法吗?
在这种情况下,您正在使用 innerHtml 属性 绑定,您可以放置 html link in your description text with target="_blank" 以在新选项卡中打开 link:
description =
'some random text <a href="https://whosebug.com" target="_blank">https://whosebug.com/</a> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s';
我有一个带有内部 html 的 span 标签,就像这样
在我的 html 中:
<span [innerHTML]="description"></span>
在我的 ts 中:
description = "some random text https://whosebug.com/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"
它显示 link 但是当我点击它时 link 它在同一个选项卡中打开,但我希望它在新选项卡中打开。
有什么办法吗?
在这种情况下,您正在使用 innerHtml 属性 绑定,您可以放置 html link in your description text with target="_blank" 以在新选项卡中打开 link:
description =
'some random text <a href="https://whosebug.com" target="_blank">https://whosebug.com/</a> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s';