i want to hide the img tag when the “pic” property of the current ellement is empty but no way to get it work. i do this by checking if the property lenght is greater than 0.
html is
<div class="list card" ng-repeat="fonctionnement in fonctionnements "><div class="item item-divider"><strong>{{fonctionnement.name}}</strong></div>
<div class="item item-body">
<img ng-if='hasPicture("{{fonctionnement.pic}}")' class="full-image" src="img/{{fonctionnement.pic}}">
<p>{{hasPicture("pop")}}
{{fonctionnement.text}}
</p>
</div>
**The js is**
.controller('InternetCtrl', function($scope,Fonctionnement) {
$scope.fonctionnements=Fonctionnement.all();
$scope.hasPicture = function(item){
//return (item.length > 0) ;
if(item.length > 0){
return true
}
else return false
}
})
here is the sevice code
.factory('Fonctionnement', function() {
var items = [
{ id: 0, name:"XXX", pic: "pic.jpg", text: "...."},
{ id: 1, name:"XXXX", pic: "", text: "l'utilisateur qui ..."},
{ id: 2, name:"XXX", pic: "", text: "De l'autre côté...."},
];
return {
all: function() {
return items;
}
}
})
thanks for your help