I have an element as below :
<a class="previous i-previous fa fa-caret-left" href=""
ng-click="setPage(currentPage-1)"
ng-hide="currentPage == 0">
</a>
I had this code working but now I have this exception :
Error: [$parse:syntax] http://errors.angularjs.org/1.2.26/$parse/syntax?p0=undefined&p1=is%20unexpected%2C%20expecting%20%5B)%5D&p2=null&p3=setPage(currentPage&p4=setPage(currentPage
The code that causes the exception is :
ng-click="setPage(currentPage-1)"
When i removed -1 it works so it seems the problem is about that part.
What might be the cause of this exception?
EDIT :
I have this code in my controller :
$scope.currentPage = 0;
$scope.setPage = function (page) {
$scope.currentPage = page;
};
setPage(--currentPage)