title: knockout.js binding error within foreach block
body: <p>I am new to knockout.js and am having a problem with binding within a <strong>foreach</strong> section.  I am receiving the error:</p>
  
  <p>Uncaught Error: Unable to parse bindings.
  Message: ReferenceError: hideSearchElements is not defined;
  Bindings value: click: hideSearchElements </p>
  
  <p>Here is an exert of the html:</p>
  
  <pre><code> &lt;div id="searchResults" data-bind="visible: searchIsVisible"&gt;
    &lt;label id = "lblSearchResults"&gt;select a template:&lt;/label&gt;   
    &lt;div data-bind="foreach: titles"&gt;
      &lt;div data-bind="text: Title"&gt;&lt;/div&gt;
      &lt;div data-bind="click: hideSearchElements"&gt;hide&lt;/div&gt;
   &lt;/div&gt;   
  </code></pre>
  
  <p></p>
  
  <p>And an exert from the viewModel:</p>
  
  <pre><code>var viewModel = function () {      
      this.searchIsVisible = ko.observable(true);               
  
      this.showSearchElements = function () {
         this.searchIsVisible(true);
      };
  
      this.hideSearchElements = function (
         this.searchIsVisible(false);                    }
      }
  
   return new viewModel();
  </code></pre>
  
  <p>I have both <strong>showSearchElements</strong> and <strong>hideSearchElements</strong> working fine outside of the foreach block but when inside it, I get the error.</p>
  
  <p>If I add <code>$parent.hideSearchElements</code> I can bind but then get an error saying:</p>
  
  <p>Uncaught TypeError: Object # has no method 'searchIsVisible' 
  .</p>
  
  <p>I have probably have two distinct issues but thought the detail may help :)</p>
  
  <p>I'm keen to understand what's going on here?  Can anyone help please?</p>
  
  <p>A link to the relevant page in the documentation would also be very helpful - I'm reading through that now. </p>
  
  <p>Thanks</p>