AngularJS ng-class no funciona para condiciones
Frecuentes
Visto 2,170 veces
1
This is very straightforward but I am not able to change the class.
I am basically verifying if the date is in correct format (DD-MMM-YYYY hh:mm:ss).
<input type="text" style="width : 80%" ng-model="startTime" ng-class="{invalid: !isValid ,valid: isValid}" />
where isValid is a scope variable which evaluates to true and false. The css class is not applied.
Aquí está la plnkr.
1 Respuestas
5
It is working. Inspect the element. Your bootstrap classes are overwriting it. Try this:
.invalid {
background-color: #FA787E !important;
}
.valid {
background-color: #78FA89 !important;
}
Respondido el 26 de Septiembre de 13 a las 19:09
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas angularjs ng-class or haz tu propia pregunta.
Yes. Just figured that out . The !important was important. Thanks - paquete perdido