I have written the condition as
ng-class="{true: 'ion-ios-heart', false: 'ion-ios-heart-outline'}[favOffers[offer.id]]"
i.e if favOffers[offer.id] has a value then apply the class in true statement else apply the class in false statement.
But it is not working. favOffers is defined in my controller.