0

I'm using knockout with the knockout.viewmodel plugin. http://coderenaissance.github.io/knockout.viewmodel/

// JavaScript
// data variable is loaded from an ajax call
/*
   var data = { simple: { friendlyText: "Hello World" } };
*/
viewmodel.scenario = ko.viewmodel.fromModel(data, options);

<!-- HTML Page -->
<!-- This does not bind -->
<input type="text" length="50" data-bind="textInput: scenario.simple.friendlyText" />

<!-- This does bind -->
<label data-bind="text: scenario.simple.friendlyText"></label>

What's special about the textInput binding on the input element that I'm missing or not doing?

CrimsonChris
  • 4,581
  • 2
  • 17
  • 30
Danno
  • 913
  • 3
  • 15
  • 28
  • 1
    Sounds like it's making a dependent (read-only) observable. That would explain why it won't work for text**Input**. – CrimsonChris Sep 16 '15 at 20:31

1 Answers1

0

You have picked the knockout-2.0 tag for your question. If you are indeed using knockout version 2, then textInput will not work, as it was added at a later time. In Version 3.2

t1nr2y
  • 616
  • 8
  • 20
  • That's exactly what the problem was. I'm using the SPA template from Visual Studio and didn't think that the knockout version would be that old. – Danno Sep 17 '15 at 10:46