Angular 2 - Check if image url is valid or broken

后端 未结 9 1998
感情败类
感情败类 2020-11-29 19:31

I am fetching a large number of image URLs from an API and display them in a angular 2 web application. Some of the URLs are broken and i want to replace them with a default

9条回答
  •  清歌不尽
    2020-11-29 20:14

    I found a very simple solution that worked for me. This doesn't check for 404's however I had objects that possibly had and .image attribute. I know this isn't the answer to his question but hopefully it helps some one out there.

    
    

提交回复
热议问题