To shorten up the post this is all the info needed for my problem, so i made a button that gives +1 rating and a button for -1 rating when clicked and this is its HTML code,
<p>
<strong>Rating: </strong> {{ album.rating }}
<button class="btn btn-small" ng-click="upVoteRating(album)">+</button>
<button class="btn btn-small" ng-click="downVoteRating(album)">-</button>
</p>
Nothing unusual, heres the angularjs code using scope and the function for the button.
$scope. upVoteRating = 'upVoteRating';
$scope. downVoteRating = 'downVoteRating';
function upVoteRating(album) {
album.rating++;
}
function downVoteRating(album) {
if (album.rating > 0)
album.rating--;
}
So theres no problem with the code by my guessings but everytime i click the button on my page, it says this on the console:
"TypeError: string is not a function
at http://localhost:1234/lib/angular/angular.min.js:168:37
at http://localhost:1234/lib/angular/angular.min.js:186:167
at g.$eval (http://localhost:1234/lib/angular/angular.min.js:104:308)
at g.$apply (http://localhost:1234/lib/angular/angular.min.js:105:48)
at HTMLButtonElement.o.event.dispatch (http://localhost:1234/lib/jquery-2.1.0.min.js:3:6055)
at HTMLButtonElement.r.handle (http://localhost:1234/lib/jquery-2.1.0.min.js:3:2830) angular.js:9507"
I've got no idea how to fix this, i've been looking for an hour, so please, if you need more code to help you out to find the problem out ask right away!
Thanks again!
$scope. upVoteRating = upVoteRating;- JavaScript functions are first order, you can pass them like that.