title: Angular JS: using ng-switch and checking if file exists
body: <p>i am looping through a list of things, and if a thing has an image i want to show it. </p>
  
  <p>but if a thing does not have an image, i want to display default text:</p>
  
  <pre><code>&lt;div ng-repeat="myThing in myThings&gt;
    &lt;div ng-switch on="{{myThing.img}}" &gt;
      &lt;span ng-switch-when="{{myThing.img}}"&gt;
        &lt;img src="/img/myThings/{{myThing.id}}" /&gt;
      &lt;/span&gt;
      &lt;span ng-switch-default&gt;No Image&lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>this works and the default text is displayed. </p>
  
  <p>however, the browser is also throwing an error trying to get an image which does not exist:</p>
  
  <pre><code>http://localhost:9000/img/myThings/%7B%7BmyThing.id%7D%7D 404 (Not Found)
  </code></pre>
  
  <p>is there a way to format this ng-switch function so that this error is not thrown? </p>