img 标签上的src 链接图片不存在时 怎么处理

// .html

<img [src]="nzSrc" *ngIf="nzSrc && hasSrc" (error)="imgError()"/>  

// .ts
imgError(): void { // 没有图片时会触发

  }
原文地址:https://www.cnblogs.com/flxy-1028/p/10951375.html