I have a DataBase on firebase like this one:
{
Dogs {
Dog1{
name: 'name1',
breed: 'breed1',
sold: true
}
}
}
and I have a set of cards on Ionic showing the information of every dog.
I would like to be able to change the css of the cards when the value sold is true like changing its background color or setting a text.
It is possible using firebase?
This is my try:
Controller:
$scope.soldClass = [];
var firebaseObj = new Firebase("https://<MY-APP>.firebaseio.com/Dogs");
firebaseObj.orderByChild("sold").on("child_added", function(snapshot) {
console.log(snapshot.key() + " was " + snapshot.val().sold + " sold");
$scope.soldClass = snapshot.val().sold;
return $scope.soldClass;
});
and my Div:
<div class="item item-avatar" ng-class="{sold: soldClass == 'true'}">
CARD
</div>
The problem is that it applies the class to all the cards even when on the database the sold value is false.