knockout.js - Unable to update observable value in subscribe method -
i have subscribe function fires when dropdown value changes. want update observable value inside subscribe function. probelm when control leaves subscribe function observable value got null or empty.
self.selectedsubaccount.subscribe(function (newvalue) { //alert("the selected account code:" + newvalue); var likecode = newvalue.substring(0, 2); var acctype = "control"; self.account_code = genrateaccountcode(self.subaccounts(), likecode, acctype); });
assuming self.account_code
observable, update so:
self.account_code(genrateaccountcode(self.subaccounts(), likecode, acctype));
Comments
Post a Comment