title: Removing item from observablearray in Knockoutjs
body: <p>I am trying to learn Knockoutjs and I am having some issues with adding and removing objects to an observablearray.</p>
  
  <p>I have the following viewmodel in which I fetch some data from a webservice and populate some html. This works fine. But what does not work is removing items from the observablearray since it seems the click-event does not call removeEmployee.</p>
  
  <pre><code>function EmployeeViewModel(){
      var self=this;
  
      self.employees=ko.observableArray();
  
      self.removeEmployee = function(item) {
          self.employees.remove(item);
      };
  }
  
  function success(data) {
      EmployeeViewModel.employees=ko.mapping.fromJS(data);
      ko.applyBindings(EmployeeViewModel);    
  };
  
  ApiCall({
      data: {
        [get data]
      },
      onSuccess: function(data){success(data.result)} 
  });
  </code></pre>
  
  <p>and the following html:</p>
  
  <pre><code>&lt;div data-bind="foreach: employees"&gt;   
      &lt;h2&gt;Hello, &lt;span data-bind="text: full_name"&gt; &lt;/span&gt;!&lt;/h2&gt;  
      &lt;button data-bind="click: $parent.removeEmployee"&gt;Remove&lt;/button&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>I have tried setting up a jsfiddle here: <a href="http://jsfiddle.net/8yX5M/" rel="nofollow">http://jsfiddle.net/8yX5M/</a> in which removing items does work. The difference is, that in the jsfiddle the items are not fetched from an external source and that I use removeEmployee rather than $parent.removeEmployee. </p>
  
  <p>Any ideas why the non-jsfiddle version is not working ?</p>
  
  <p>thanks
  Thomas</p>