In my model I have
self.isAssetForTradingEnabled = false;
and when I try to bind it to add some style like this:
<tr data-bind="css: { 'selected': quantity() > 0 , 'disabled': !isAssetForTradingEnabled() }">
Then Knockout gives a type error.
It works if I change
isAssetForTradingEnabled = true;
and
'disabled': isAssetForTradingEnabled
If you have this...
...you should not do this...
...because
isAssetForTradingEnabled
is not a(n observable) function. Instead either do this......or change your view model to this...
Note that you need the latter if you want the view to respond to changes in
isAssetForTradingEnabled
, because plain (non-observable) members aren't tracked.