【问题标题】:How to specify replace url option in router link angular html template如何在路由器链接角度 html 模板中指定替换 url 选项
【发布时间】:2021-05-29 12:53:30
【问题描述】:
 <button color="dark" fill="outline"  [routerLink]="['/home']" size="medium"
          >Click here to add some</button>

我应该如何像在 TS 文件中那样传递替换 URL 选项

 await this.router.navigate(['/profile'], { replaceUrl: true });

【问题讨论】:

    标签: html angular


    【解决方案1】:

    我是通过查看角度路由的类型文件自己发现的 :) 我是这样做的

    <button color="dark" fill="outline" replaceUrl="true"   routerLink="['/home']" size="medium"
                  >Click here to add some</button>
    

    【讨论】:

      【解决方案2】:
      <button replaceUrl="true" routerLink="/home">Click here to add some</button>
      

      如果 replaceUrl 和 routerLink 不是绑定的而是简单值,则不必使用 []。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-05-11
        • 1970-01-01
        • 1970-01-01
        • 2018-02-10
        • 2019-05-11
        • 1970-01-01
        • 1970-01-01
        • 2018-04-18
        相关资源
        最近更新 更多