javascript - Access knockoutjs ViewModel from outside binding scope -


i have page has parent area has 2 children areas, simplified following

<div id='parent'>    ....other parent's html markups ....     <div id='signin'>         ... signin's html markups ....    </div>    <div id='register'>         ... register's html markups ....    </div> </div> 

each of 'child' divs binds own viewmodel

ko.applybindings(new signinmodel(), document.queryselector('#signin')) ko.applybindings(new registermodel(), document.queryselector('#register')) 
  1. how can bind parent's html markups outside of both children divs properties of either signin or register viewmodel ?? or have merge 2 viewmodels one, bind parent?

  2. how can bind html markup inside 'signin' div property of signinmodel viewmodel, or otherway round?

thanks

i don't think can. have bind parent , can use data-bind span.


Comments

Popular posts from this blog

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

C# random value from dictionary and tuple -

algorithm - Testing tetrahedron-triangle intersection -