Skip to content

Commit

Permalink
feat(): add fallback to img tag when loaded in browser (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf authored and ihadeed committed May 4, 2017
1 parent 7fb3935 commit ad049a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/img-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ export class ImgLoader implements OnInit {

// set it's src
this._renderer.setElementAttribute(this.element, 'src', imageUrl);

if(this.fallbackUrl){
this._renderer.setElementAttribute(this.element, 'onerror', 'this.src=\'' + this.fallbackUrl + '\'');
}
} else {

// Not using <img> tag
Expand Down

0 comments on commit ad049a9

Please sign in to comment.