Ionic Count likes


I want to add in my a like system, when you click on the button it shows 1 (++), and when you clique again it shows 0(–), But also I want it to be in realtime, other people can see it.

I hope you understood me.


Please post some sample code… also what backend are you using ?

Look at the screen, My app is like this, showing cards… I want to add two buttons (LIKE and DISLIKE) with Count number…
I don’t have a code, I’m trying to create this function…

If you want that people can like or dislike you need a backend for it.

Or will it be something like a test/show off dummy ?

What do you mean by backend ?
I go an idea to use firebase, and people can see likes in realtime, not just in my device :confused:

You need the backend to handle the likes, users, pictures and everything else.

Firebase is a very good option to use but the downside by it is that the documentations are very bad. So you should consider buying some books to learn it the most efficient way.

Before you didn’t implemented Firebase into your project you shouldn’t worry to much about the Frontend now since you need to understand both sides.

But to answer the Frontend question you could do it like this.


<ion-button (click)="handleLike()">{{LikeValue}}</ion-button>
<ion-button (click)="handleDislike()">{{DislikeValue}}</ion-button>


export class YourClass{

LikeValue: number;
DislikeValue: number;

  this.LikeValue = 0;
  this.DislikeValue = 0;


Now your counters should raise as you click the buttons.


Thank you for your time <3 Now I just need to do it in realtime, I’ll test your code and thank you again

1 Like