簡體   English   中英

角材料,使 <mat-chip> 點擊

[英]Angular Material, make <mat-chip> clickable

我正在使用來自material.angular.io的墊片

<mat-chip-list class="categories">
    <mat-chip><a href="/publication/category/{{category.id}}">
    {{category.name}}</a></mat-chip>
</mat-chip-list>

如果單擊鼠標的中心按鈕,則該鏈接有效並打開另一個選項卡,但是單擊鼠標左鍵將無法打開該鏈接。

我嘗試了class =“ link-overlapping”,但仍然無法正常工作。

您完全不需要錨,您可以直接在mat-chip上使用routerLink

<mat-chip-list class="categories">
  <mat-chip [routerLink]="['publication/category', category.id]">
    {{category.name}}
  </mat-chip>
</mat-chip-list>

您嘗試使用routerLink嗎? 這個對我有用。

  <mat-chip-list class="categories">
      <mat-chip><a [routerLink]="['/your_path']">{{ data }} </a></mat-chip>
    </mat-chip-list>
  </div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM