使用 ng-click 时如何允许“在新标签页中打开"? [英] How to allow 'Open in a new tab' when using ng-click?
问题描述
我有一个 HTML 表格,每一行都指向不同的页面,其中包含有关该行的更多详细信息.但是当我使用 angularjs 时,使用 ng-click 我无法右键单击该行并选择在新选项卡中打开".有什么办法可以解决吗?
I have a table on HTML and each row leads to a different page, with more details about that row. But as I am using angularjs, with ng-click I can't right click this row and select 'open in a new tab'. Is there any way to solve it?
提前致谢!
推荐答案
如果可能,您应该将元素转换为锚元素.
<a ng-href="{{ your dynamic url }}" ng-click="your function">Your link text</a>
浏览器会将元素解释为链接,因此会为您提供正确的下拉列表.请注意,您还必须拥有正确的 href 值才能在新标签页中打开.
The browser will interpret the element as a link, and will therefor give you the correct dropdown. Note that you also have to have the correct href value to open in a new tab.
如果您想要更详细的答案,我会推荐这个问题关于如何使用 JQuery 修复这种行为.
I would recommend this question if you want a more detailed answer on how to fix this kind of behaviour using JQuery.
这篇关于使用 ng-click 时如何允许“在新标签页中打开"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!