title: Angular ngClass and click event for toggling class
body: <p>In Angular, I would like to use <code>ngClass</code> and click event to toggle class. I looked through online but some are angular1 and there isn't any clear instruction or example. Any help will be much appreciated!</p>
  <p>In HTML, I have the following:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;my_class&quot; (click)=&quot;clickEvent($event)&quot; ngClass=&quot;{'active': toggle}&quot;&gt;
    Some content
  &lt;/div&gt;
  </code></pre>
  <p>In <code>.ts</code>:</p>
  <pre class="lang-js prettyprint-override"><code>clickEvent(event) {
    // Haven't really got far
    var targetEle = event.srcElement.attributes.class;
  }
  </code></pre>