简体   繁体   English

"为什么我必须在一个按钮上单击两次才能重定向到正确的 url?"

[英]Why do I have to click two times on a button to be redirected to the right url?

I have this click event written with Angular material in the app.component.html file:我在 app.component.html 文件中使用 Angular 材料编写了这个点击事件:

<button mat-icon-button class="icon account-icon" aria-label="Icon-button with account icon" (click)="gotoLoginPage()" routerLink={{url}}  routerLinkActive="active">
    <mat-icon>account_circle</mat-icon>
  </button>

Just in case somebody is facing my same problem, I resolved it in this way:以防万一有人遇到我同样的问题,我以这种方式解决了它:

In app.component.html, instead of the following:在 app.component.html 中,而不是以下内容:

<button mat-icon-button class="icon account-icon" aria-label="Icon-button with account icon" (click)="gotoLoginPage()" routerLink={{url}}  routerLinkActive="active">
    <mat-icon>account_circle</mat-icon>
  </button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM