IONIC: Like dislike functionality within `ng-repeat`

I am new with ionic framework.Currently i am working on ionic iOS app. I need to do like dislike functionality. As i have multiple records coming from web service and for each record i have to put functionality of like,dislike and comment with total count and saved these information into database.

Also change CSS for like and dislike button.

I do not understand how to establish this function into my app.Please help me to do this

Hi @hariomtech

If suppose you are getting array of record
for ex.

 {
   "Name" : "XYZ",
   "Age" : 23,
   "Post" : "Some bla bla....."
 },
{
   "Name" : "XYZ",
   "Age" : 23,
   "Post" : "Some bla bla....."
 },
 {
   "Name" : "XYZ",
   "Age" : 23,
   "Post" : "Some bla bla....."
  }
]; 

and then in your html you have ng-repeat something like


<ion-list ng-repeat="data in recordArray">
  <ion-item>
        {{ data.Name }}
  </ion-item>
<ion-item>
        {{ data.Age }}
  </ion-item>
<ion-item>
        {{ data.Post }}
  </ion-item>
  <ion-item>
        <i class="ion-thumbsup" ng-click="like()"></i> &nbps <i class="ion-thumbsdown" ng-click="dislike()"></i>
  </ion-item>
</ion-list>

try it and let us know

1 Like

Thank you so much for the reply But i need only one button for like and dislike.

How can one button do two things?

1 Like