javascript - angular, ng-class with function inside repeat -



javascript - angular, ng-class with function inside repeat -

i'm trying set class on input if meets requirements , having problems

it looks -

ng-class="'ispartial': canpartial($index)"

this within repeat, function it's referring looks so

$scope.canpartial = function(index) { var needsmet = _.reduce($scope.allaccounts[index].schools, function (memo, schools) { homecoming memo + (schools.selected ? 1 : 0); }, 0); console.log(needsmet); homecoming (needsmet === $scope.allaccounts[index].schools.length); };

so it's using underscore.js check if children checked. know function works correct, issue passing status ng-class. if returns true add together class. i'm getting $parse.syntax error , cannot seem figuire out why because se other examples of ng-class using function. perhaps it's because i'm trying pass $index, within repeat, don't know if causes issue.

any help much appreciated. thanks!

you don't have valid ng-class expression. alter ng-class declaration in order take object value:

ng-class="'{ispartial': canpartial($index)}"

javascript angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -