javascript - Knockout js subscribe behaves differently -


i using subscribe in application use 3 subscribe first 2 works last observable add subscribe doesn't work want.

  // listen likelihood everytime change change risklevel         self.likelihood.subscribe(function (newvalue) {                            self.risklevelname(getrisklevel(newvalue, self.consequence()));         });         self.consequence.subscribe(function (newvalue) {             self.risklevelname(getrisklevel(self.likelihood(), newvalue));         }); 

when change likelihood or consequence change value of risklevelname it's working great. add breakpoint in

 self.risklevelname(getrisklevel(newvalue, self.consequence()));  

i noticed didn't heat breakpoint when change value of likelihood. funny thing change value of self.risklevelname.

i add code subscribe account it's not working. didn't error in console

       self.account.subscribe(function (newvalue) {             console.log(newvalue);         }); 

here way bind them dom elements

 <div class="span6">           <div class="control-group" id="likelihoodmodalcontrolgroup">                    <label class="control">likelihood</label>                    <div class="controls">                          <select id="likelihood" class="input-large custom" data-bind="value:likelihood, options:$root.likelihoodlist, optionsvalue:'key', optionstext:'value', optionscaption:'select likelihood'">                                     <option value="0">select likelihood</option>                            </select>                       </div>              </div>    </div>    <div class="span6">              <div class="control-group" id="consequencemodalcontrolgroup">                      <label class="controls">consequence</label>                      <div class="controls">                          <select id="consequence" class="input-large custom" data-bind="value:consequence, options:$root.consequencelist, optionsvalue:'key', optionstext:'value', optionscaption:'select consequence'">                              <option value="0">select consequence</option>                           </select>                      </div>                </div>    </div>    <div class="span6">       <div class="control-group" id="accountmodalcontrolgroup" >            <label>account</label>            <div class="controls">                                                        <select class="input-large custom"  data-bind="value:account, options:$root.projectlist, optionsvalue:'key', optionstext:'value', optionscaption:'select account'">                           <option value="0">select account</option>                      </select>                                                 </div>      </div> </div> 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -