I’m not sure what is wrong with this binding statement.
css: { 'error': responseStatus < 0, 'success': responseStatus > 0 }
Here is a working example: http://jsfiddle.net/awoehler/zEn3t/
My server will respond JSON response containing either response.MESSAGE or response.ERROR and I want to apply a class based on which response I receive.
viewUserModel = {
serverResponse: ko.observable(),
responseStatus: ko.observable( 0 ), // -1, 0, or 1
displayServerResponse: ko.observable( false )
//....
}
When referring to observables in expression, they must be called as function to get their value. So changing this:
to this:
should make your code work.