0
I’d like to call in functions in the ngClass. I was able to call only the function, and if I want to call other classes it does not take, if I just put the function in the class it can call(ng-class="styleClass(5)"), but I want some classes to always be and others can be changed by other validations. When I take the function from the example, it works all right.
Follow the Example:
Javascript
$scope.styleClass = function(i) {
console.log("entrou");
if(i>1){
return 'bg';
}
return ''
}
HTML
First Name: <input type="text" ng-class="{'text':true, 'padd':true, 'styleClass(5)':true}" ng-model="firstName"><br>
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack