Like Button - Ionic App


#1

Good morning everyone, I’m stuck on a problem here that maybe will be simple for a lot of people here in the forum.
What I want is put a button that make likes on a specific record that was previously selected by ID, this will work like a facebook like button but I’m don’t want get so far, I’ll not use Facebook api, just a simple increment likes button and a label to show how many likes that record have, so this instruction needs to…

If the field like not exist on that record… create and add one like
If exists, add one more…

Plunker here… http://plnkr.co/edit/bcnm4SDTQEie8emuM7lC?p=preview
Please go to detail page!!!

For this my app uses IONIC, firebase and AngularJS

I’m totally newbie, so if you could give me more detail possible… My gratitude!!!
Thank you… Ionic is perfect and you guys make it even better!!!

@brandyshea


#2

If you want to persist data through controllers only just create return service and assign values to service and they’ll become global

But if you wanna do something more like facebook like and staff u should use a database or database services like firebase.

just create a $http service which posts data to the your webapi(if you dont have one you should create one) the like and increments number of the likes at the server side.And on the ionic side just increment the number for user. When user refreshes the page it should get the like count from database.