Reputation: 19
I want to show differents image depending of variable value. if the user.ima variable is empty must show defaultImg variable.
<img class="" ng-src="{{this value depend of user.ima if empty then load defaultimg}}" width="60px" >
Upvotes: 1
Views: 39
Reputation: 29836
Use a method:
$scope.GetImgUrl = function(){
if(!$scope.user.ima)
{
return $scope.defaultImgUrl;
}
return $scope.user.ima;
}
And:
<img class="" ng-src="{{GetImgUrl()}}" />
Upvotes: 2