AngularJS syntax error on expression when using add/subtract operators -


i have element below :

<a class="previous i-previous  fa fa-caret-left" href=""     ng-click="setpage(currentpage-1)"     ng-hide="currentpage == 0"> </a> 

i had code working have 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 causes exception :

ng-click="setpage(currentpage-1)" 

when removed -1 works seems problem part.

what might cause of exception?

edit :

i have code in controller :

$scope.currentpage = 0; $scope.setpage = function (page) {          $scope.currentpage = page;     }; 

it caused batarang in chrome, disable or use other browser test, or use incognito mode.

https://stackoverflow.com/a/31006278/5039495


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -