title: Trigger method with click and drag (Angular)
body: <p>I have a table, where I'd like users to be able to trigger a method with a click and drag across multiple cells (i.e., changing background color of cells that were clicked/dragged over).</p>
  
  <p>I want to create this in Angular.</p>
  
  <p>When I use the click method, it only triggers on the cell that is first clicked, not any other cells where the mouse is down (i.e., I have to click every cell to highlight or unhighlight).</p>
  
  <p>It should look like this:
  <a href="https://i.stack.imgur.com/Nb6Ei.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nb6Ei.gif" alt="enter image description here"></a></p>
  
  <p>Below is a <a href="https://stackblitz.com/edit/angular-1dpmki" rel="nofollow noreferrer">stackblitz</a></p>
  
  <p>Component:</p>
  
  <pre><code>&lt;table&gt;
    &lt;TR&gt;
      &lt;TD *ngFor="let b of colCount" 
          (click)="b.highlight = !b.highlight" 
          [class.highlight]="b.highlight"
      &gt;&lt;/TD&gt;
    &lt;/TR&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>TS:</p>
  
  <pre><code> colCount = [{highlight: true},{highlight: true},{highlight: true},{highlight: true},{highlight: true},{highlight: true}]
  
    select(b) {
      console.log(b)
      b.highlight = !b.highlight
    }
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>td {
   border: 1px solid black;
   width: 20px !important;
   height: 20px !important;
  }
  
  .highlight {
    background-color: blue;
  }
  </code></pre>