对于img标签路径加载失败是的处理(onerror事件)
<!-- angular2中的写法 -->
<img *ngIf="showLogo" [src]="logoUrl" alt="logo" class="logo" (error)="imgerror($event)">
<!-- html页面中的写法 -->
<img src="http://localhost:49610/Content/Images/logo_mobile.png" alt="" onerror="imgerror(this)"/>
imgerror(e) {
this.showLogo = false;
console.log("找不到图片");
e.onerror = null; // 控制不要一直跳动
}