lundi 30 mars 2015

Replace with default image if image not found -angularjs

What could be the best possible condition to check and display if the image path is undefined in AngularJS. I have tried like this:



HTML:
<div ng-src="{{imageUrl}}" == "null" || src="img/avatar.png" >

CONTROLLER:
$scope.imageUrl="125.178.1.127/uploads/image" +$scope.imageName;


If $scope.imageName is undefined I have to load/show the default image img/avatar.png


Aucun commentaire:

Enregistrer un commentaire