I'm having trouble getting Knockout to update the value of my observable.
Model:
function AppViewModel() {
var self = this;
self.observable = ko.observable();
self.test = function() {
self.observable("test")
}
};
var model = new AppViewModel();
ko.applyBindings(model);
View:
<p>Value of observable: <input data-bind="value: $root.observable()" /></p>
<p>The value is: <span data-bind="text: $root.observable()"></span></p>
When I type text into the input field, it should update the value of my observable to what I've typed, correct? But the 2nd paragraph doesn't update its text accordingly.
Thanks!