javascript - Why is this twitter bootstrap modal not working when using knockout js? -


i trying knockout js working twitter bootstrap modal dialog.

i have taken contacts editor example knockout js website , altered use modal dialog add/edit.

i have spent quite while trying make work reason not.

you can view here:

http://jsfiddle.net/27pscgnk/5/

thanks in advance solutions

i think problem may in here (this not getting called when user clicks save):

self.addcontact = function() {     self.contacts.push({         firstname: "",         lastname: "",         phones: ko.observablearray()     }); }; 

i removed of errors in fiddle , changed add function work based on input, @ fiddle http://jsfiddle.net/27pscgnk/6/

self.contact = {     firstname: ko.observable(),     lastname: ko.observable(), }  self.addcontact = function() {     self.contacts.push({         firstname: self.contact.firstname(),         lastname: self.contact.lastname(),         phones: ko.observablearray()     }); }; 

and in binding:

<div class="form-group">     <label for="inputnamelbl" class="col-sm-2 control-label">first name</label>     <div class="col-sm-10">         <textarea data-bind="value: contact.firstname"></textarea>      </div> </div> <div class="form-group">      <label for="inputdesclbl" class="col-sm-2 control-label">last name</label>      <div class="col-sm-10">           <textarea data-bind="value: contact.lastname"></textarea>      </div> </div> 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -