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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -