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