I am using knockout.js. I created a view model say testViewModel
with only 1 observable property testProperty
.
function testViewModel()
{
var self = this;
self.testProperty = ko.observable("Initial");
}
than i created a span
in which the changed value of testProperty
is reflected and a input text field
by which we can change the testProperty
value.
<span data-bind="text: testProperty"></span><br />
<input type="text" data-bind="value: testProperty" />
I created an Example Fiddle.It seems that the observable property value is updated when the focusout event is executed on the input text field.
Now my question is that can we change the observable property value update event from focusout to something else. I created a save button also. Is there any way to update the observable property value only on save button press.
I am trying to create an application in which a user can create and save its profile and can edit the saved profile.I am using the same observable properties in create and edit form and these properties are observable. So when user edit its profile the ui should not be updated until user press the save button. This is my goal. Please help me to solve this issue ?