title: knockoutjs calling function which is defined in sub-viewModel from root-viewModel
body: <p>I have a single page application with structure:</p>
  
  <ul>
  <li>ViewModel-RootVM (page header, footer, common functions, ...):
  <ul>
  <li>SubModelA (page1 - template)</li>
  <li>SubModelB (page2 - template)</li>
  </ul></li>
  </ul>
  
  <p>I would like to call a function fnTest which is defined on page 2 (SubModelB) from page header (ViewModel-RootVM). How can I do that from ViewModel and from HTML? Is this even possible? If so, please help me with an example. I'm a little lost here.</p>
  
  <p>I'm using knockoutjs v2.2.1 and jQuery v1.9.1</p>
  
  <p><strong>ViewModel</strong> (you can see the rest of the code in jsfiddle, link below)</p>
  
  <pre><code>var View = function(title, templateName, data) {
          var self = this;
  
  
      self.title = title;
      self.templateName = templateName;
      self.data = data;
  
      self.myPostProcessingLogic = function(element1, index1, data1) {
          console.log('post processing');
      };
  };
  
  var SubModelA = function(root) {
      var self = this;
  
      self.items = ko.observableArray([
          { id: 1, name: "one" },
          { id: 2, name: "two" },
          { id: 3, name: "three" }
        ]);
  };
  
  var SubModelB = function(root) {
      var self = this;
  
      self.firstName = ko.observable("Bob");
      self.lastName = ko.observable("Smith");
  
      self.fnTest = function() {
          alert('calling function from subModelB');
      };
  
      self.fnSubModelB = function() {
          root.allert('calling function allert from root');
      };
  };
  
  var ViewModel = function() {
      var self = this;
  
      self.views = ko.observableArray([
          new View("one", "oneTmpl", new SubModelA(self)),
          new View("two", "twoTmpl", new SubModelB(self))
          ]);
  
      // default open page 'two'
      self.selectedView = ko.observable(self.views()[1]);
  
      self.allert = function() {
          alert('alert from rootVM');
      };
  
      self.allert2 = function() {
          // how can I call function 'fnTest' which is defined in SubModelB
          self.views()[1].fnTest(); // this is not working
      };
  };
  
  var viewModel = new ViewModel();
  ko.applyBindings(viewModel);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/jqWizard/vxLjP/3/" rel="nofollow">link to jsfiddle</a></p>