While iterating through a list, I want to display an image if one exists for each item. If no image is present, default text should be shown instead:
<div ng-repeat="myThing in myThings>
<div ng-switch on="{{myThing.img}}" >
<span ng-switch-when="{{myThing.img}}">
<img src="/img/myThings/{{myThing.id}}" />
</span>
<span ng-switch-default>No Image</span>
</div>
</div>
The default text is successfully displayed, however, the browser attempts to retrieve an image that does not exist, resulting in the following error:
http://localhost:9000/img/myThings/%7B%7BmyThing.id%7D%7D 404 (Not Found)
Is there a way to modify the ng-switch function to prevent this error from occurring?