【问题标题】:How to include anchor at the end of the link using routerlink?如何使用 routerlink 在链接末尾包含锚点?
【发布时间】:2018-04-13 08:35:40
【问题描述】:

如何使用 routerlink 在链接末尾包含锚点?

我需要在链接末尾添加一个锚点,以便能够识别要访问的页面上的特定位置。

<a [routerLink]="['/page', item.slug]#local"> Button </a>

页面

<a name="local"></a>

【问题讨论】:

标签: angular angular-router


【解决方案1】:

&lt;a [routerLink]="['/page', item.slug]#local"&gt; Button &lt;/a&gt;

无法正常工作。

您可以参考this one

【讨论】:

  • 您好,需要生成的链接是:localhost/page#location
  • navigateMe() { this.router.navigate(['/page', item.slug, local]); } ?
  • 无论如何你可以参考这个link希望这可以帮助
  • 是的。非常感谢。
猜你喜欢
  • 1970-01-01
  • 2017-06-20
  • 1970-01-01
  • 2012-07-29
  • 2021-05-23
  • 1970-01-01
  • 2014-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多