title: Passing values to ko.computed in Knockout JS
body: <p>I've been working for a bit  with MVC4 SPA, with knockoutJs, </p>
  
  <p>My problem is I want to pass a value to a ko.computed. Here is my code.</p>
  
  <pre><code>&lt;div data-bind="foreach: firms"&gt;
  &lt;fieldset&gt;
      &lt;legend&gt;&lt;span data-bind="text: Name"&gt;&lt;/span&gt;&lt;/legend&gt;
      &lt;div data-bind="foreach: $parent.getClients"&gt;
          &lt;p&gt;
              &lt;span data-bind="text: Name"&gt;&lt;/span&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;/div&gt;
  
  self.getClients = ko.computed(function (Id) {
      var filter = Id;
      return ko.utils.arrayFilter(self.Clients(), function (item) {
          var fId = item.FirmId();
          return (fId === filter);
      });
  });
  </code></pre>
  
  <p>I simply want to display the Firmname as a header, then show the clients below it. 
  The function is being called, but Id is undefined (I've tried with 'Firm' as well), if I change:</p>
  
  <pre><code>var filter = id;     TO      var filter = 1;
  </code></pre>
  
  <p>It works fine, </p>
  
  <p>So... How do you pass a value to a ko.computed? It doesn't need to be the Id, it can also be the Firm object etc.</p>