如何在 AngulaR语言 HTML 的下拉选项中添加链接?<a> 在下拉列表中选择一个选项后标记不起作用



我尝试在下拉选项中添加链接。

编辑:问题是<a>在选择任何选项后都不工作

但是如果我右键单击任何选项并选择"在新标签中打开链接",它会跳转到该链接。所以我的链接是工作的

请帮我找一下问题

这是我的代码

<nb-select
placeholder = "Links"
nbTooltip="Select rows"
nbTooltipPlacement="top"
>
<nb-option
[nbTooltip]="'Link ' + (i + 1)"
nbTooltipPlacement="top"
value = {{i+1}}
style="color: blue;"
>
<a [href]="/some-external-links-here
"
target="_blank"
class="text-decoration-none"> Link {{i+1}} </a>
</nb-option>
</nb-select>

像这样使用

<nb-select
placeholder = "Links"
nbTooltip="Select rows"
nbTooltipPlacement="top"
>
<nb-option
*ngFor="let x of deal.holidays; let i = index"
[nbTooltip]="'Link ' + (i + 1)"
nbTooltipPlacement="top"
style="color: blue;"
>
<a [attr.href]="/some-links-here
"
target="_blank"
class="text-decoration-none"> Link {{i+1}} </a>
</nb-option>
</nb-select>

& lt; [attr.href] ="/some-links-here"

如果你想添加目标属性。

最新更新