Sunday, 8 September 2013

knockoutjs img src to external sites fallback image

knockoutjs img src to external sites fallback image

I need to display images from other sites, so I have a view model which
has a imgsrc property that references the image url, I then have the
following html binding:
<img data-bind="attr: { src : imgsrc }" />
The problem is that with them being external I could get 404 or 500
response if their site is having issues, therefore I want to display a
fallback image in case we cant load the image how can this be achieved
using knockoutjs?
Thanks

No comments:

Post a Comment