Implement likes

Hey guys,

I’m stuck for 3 days now on how to implement a like system in my application ?
Here is a exemple of my mind : When you click on the heart (represent the like), the heart become red. And if you click again, the heart return black. And if you close the app and come back on it, your change is saved.

I was wondering how does it works? Do I need to save user data ?

Sorry for my bad english, this is not my main language.


edit: I use Ionic 3

you can do something like this:
[color]="this.doesUserLikeThis(this.userId, this.itemId)? 'red' : 'green'"
and the function should check if the user likes this post, if so it returns true, and heart has color of red, otherwise it returns false and heart is gray
and obviously it has to be stored somewhere in database

While I wouldn’t necessarily call the advice in the previous post “wrong”, I would prefer having this sort of information available in a property instead of forcing a function call on every change detection iteration.

me to i want likes system and saved on firebase help me too

Ok, thanks for your repply!
Storage with native-storage should be ok right?