title: Default text for null value with knockout bindings
body: <p>I am using the same observable for display and edit views as follows. I would like a default text ('-') to appear in the display view whenever the return value is <code>null</code>, but I do not want that in the edit view. How could that be achieved?</p>
  
  <pre class="lang-js prettyprint-override"><code>function ViewModel() {
    var self = this;
    self.txt1 = ko.observable();
    self.txt2 = ko.observable();
  }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>// View Mode
  &lt;span data-bind="text:txt1"&gt;&lt;/span&gt;
  &lt;span data-bind="text:txt2"&gt;&lt;/span&gt;
  
  // Edit Mode
  &lt;input type="text" data-bind="value:txt1" /&gt;
  &lt;input type="text" data-bind="value:txt2" /&gt;
  </code></pre>