title: Angular2 - Push checked value to array on check
body: <p>I have a component that receives an object of employee records and displays them in a table. Each record has a checkbox that allows you to "select" the employee to be included in the next process.</p>
  
  <pre><code>&lt;tr *ngFor="let i of importResults" &gt;
   &lt;td&gt;
    &lt;input type="checkbox"
           value="{{ i.QID }}"
           attr.data-employeename="{{ i.PreferredName }} {{ i.LastName }}"
           [checked]="isSelected" /&gt;
    &lt;/td&gt;
    &lt;td&gt;{{ i.PreferredName }} {{ i.LastName }}&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>In this component, I created an array <code>selectedEmployees = [];</code> and my goal is that when I click a checkbox, its value is pushed to the array, as well as when I uncheck it, the value is removed from the array.</p>
  
  <p>I tried using <code>ngModel</code> for <code>2 way binding</code> but because this data doesn't have an initial checked value in the object, I wasn't able to get that working correctly.</p>
  
  <p>Is <code>ngModel</code> the best way to achieve this? Perhaps I was just going about it the wrong way.</p>
  
  <p>I tried following <a href="https://stackoverflow.com/questions/43166443/angular2-push-values-to-array-on-checkbox-selected">this question</a> but typescript threw an error saying <code>.entries</code> was not valid. It may have been for an older version of angular?</p>