So, there are a few options that you have:
-
KO will have an issue when you try to bind against undefined properties, unless they are off of an object. So, you can prefix your various bindings with
$data.
and KO will be able to parse your bindings. Sample: http://jsfiddle.net/rniemeyer/dLCL8/ If you know that several properties will always be together, then you could use awith
orif
statement around those options. -
A different take on handling “undefined” properties is to create a binding that populates these properties when they are missing. Look at this answer. It would be similar, but potentially with the ‘text’ binding. Sample: http://jsfiddle.net/rniemeyer/dLCL8/4/