I have a script that initializes a knockout by applying an empty view model to my form.
When the user enters data on the form, the view model is updated accordingly - this is the expected behavior.
Javascript
var viewModel = {
myField : ko.observable(),
init : function (somedata) {
...
ko.applyBindings(this, container);
},
...more stuff...
}
Partial
<%:Html.TextBoxFor(x => x.MyField, new Dictionary<string, object> { { "data-bind", "value: myField, valueUpdate: 'keyup'" } })%>
When I call my javascript to apply the knockout in the existing form, the value already in MyField(and then in my input field) is wiped with empty data in my knockout model (this view model is part of my javascript located in another file).
, MVC , MyField MyField. init, view MyField, , JavaScript.
?