javascript - Knockout computed observable not working -
i using knockout computed observable multiply 2 other observables. unfortunately, computed observable not seem outputting value.
var boyle1 = { volume1_text: ko.observable(parseint(2)), volume1_select: ko.observable(parseint(2)) }; boyle1.volume = ko.computed(function () { return this.volume1_text() * this.volume1_select(); }, boyle1); ko.applybindings(boyle1);
both other observables work perfectly, , binded elements on page. doing wrong?
it has html binding computed. indicated in fact, typo in markup.
markup
<input data-bind="value: volume1_text" /> <input data-bind="value: volume1_select" /> <br /><br /> <span data-bind="text: volume"></span>
model
var boyle1 = { volume1_text: ko.observable(parseint(2)), volume1_select: ko.observable(parseint(2)) }; boyle1.volume = ko.computed(function () { return this.volume1_text() * this.volume1_select(); }, boyle1); ko.applybindings(boyle1);
here working example of model , problem
Comments
Post a Comment