You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular表格如何移除“上期余额”“本期余额”行的超链接?

解决方案

你添加的两行余额数据(上期余额、本期余额)的dateOperation为空、wholeLine.REFERENCEMOUV也为空,只需要在渲染超链接的位置加条件判断即可,只有正常交易行才渲染超链接,余额行直接显示文本。

方法1:根据dateOperation判断

修改第三列的HTML代码如下:

<td scope="col">
  <ng-container *ngIf="l.dateOperation.length > 0; else plainText">
    <a (click)="goToAnnexe(l); false;" href="#">
      {{l.libelle}}
    </a>
  </ng-container>
  <ng-template #plainText>
    <span>{{l.libelle}}</span>
  </ng-template>
</td>

方法2:根据REFERENCEMOUV判断(更严谨,避免后续日期为空的正常交易被误判)

<td scope="col">
  <ng-container *ngIf="l.wholeLine.REFERENCEMOUV; else plainText">
    <a (click)="goToAnnexe(l); false;" href="#">
      {{l.libelle}}
    </a>
  </ng-container>
  <ng-template #plainText>
    <span>{{l.libelle}}</span>
  </ng-template>
</td>

两种方案都可以实现需求:正常交易行显示可点击的超链接,上期余额、本期余额两行只显示纯文本,无跳转链接。

内容的提问来源于stack exchange,提问作者user16922609

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 06:24:05