title: angular custom filter to check if image exists
body: <p>I want to display a user profile image if it exists;  else show default font awesome icon.
  The profile picture name is an <strong>unique number</strong> and the extensions can be of following types <code>(jpg, jpeg, png, gif and etc).</code></p>
  
  <p><strong>What i have done so far</strong></p>
  
  <pre><code>&lt;div ng-repeat="user in users"&gt;
      &lt;p&gt; {{user.name}} &lt;/p&gt;
      &lt;img ng-src="{{('/media/upload/' + user.id + '.jpg')}}" onerror="this.src='/media/upload/default.jpeg'" height="80px" width="80px"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Right now it only shows image with an <strong>ext</strong> <code>.jpg.</code></p>
  
  <p><strong>How can i create a custom filter to check if image is available in following extensions  <code>(jpg, jpeg, png, gif)</code>and show font awesome icon if it doesn't?</strong> </p>
  
  <p>Any help and feedback are appreciated!</p>
  
  <p>Thanks!</p>