As a newcomer to the world of coding and Angular, I am currently working on developing a calculator-style web application that includes a rating section in the footer. My main concern revolves around saving data so that it can be accessed by other users. The specific portion of code related to this is outlined below:
.controller('rateController', function() {
this.positive = 0;
this.negative = 0;
this.addLike = function () {
this.positive = this.positive + 1;
this.liked = true;
};
this.addDislike = function () {
this.negative = this.negative + 1;
this.disliked = true;
};
});
<div>
<table style="text-align:center; font-size:1em" class="table-responsive table" ng-controller="rateController as rating">
<tr>
<td>I liked it!</td>
<td>I didn't like it!</td>
</tr>
<tr>
<td><p class="likes" ng-click="rating.addLike()">+{{rating.positive}}</p></td>
<td><p class="dislikes" ng-click="rating.addDislike()">-{{rating.negative}}</p></td>
</tr>
</table>
</div>
I would greatly appreciate any guidance on how to save the number of likes and dislikes to the website's server. If you wish to see the current functionality, please visit this link. The rating table can be found in the footer.