angular-img-fallback icon indicating copy to clipboard operation
angular-img-fallback copied to clipboard

Fallback-src doesn't set the fallback image if the src is empty

Open nvivo opened this issue 8 years ago • 1 comments

When the binding value for ng-src is null, src is not set and the fallback img is not set. This happens when loading the url from database and the url is not set for example.

$scope.someUrl = null;
...
<img ng-src='{{someUrl}}' fallback-src />

The fallback-src could check for the 'src' attribute and run the fallback handler if no src is set.

nvivo avatar Sep 22 '16 14:09 nvivo

Use ng-src without brackets.

<img ng-src="user.picture || user.pictureURL" fallback-src="{{'img/user/default-avatar-male.png'}}" style="width: 20vw" />

This worked for me.

predorock avatar Nov 22 '17 11:11 predorock