Scope color in if conditional statement


#1

Hi , Is it possible in ionic to change the scope color in if conditional statement? When I enter a 1 value the colorChange turns into RED if not it turns into GREEN. Help me Thanks :smile:

<input type="text" ng-model="text">
{{colorChange}}



.controller 
$scope.colorChange = "Color"

if(text== 1){
  $scope.colorChange // Will change its color into RED

}else{
  $scope.colorChange // Will change its color into GREEN
}

#2

i would use ngClass for that (you can also use ng-style instead):

  1. create css classes for the colors if they are not already there or use ionic classes


#3

Thanks you so much ! :smile: