title: Nativescript Angular 2 - Add class to label on click
body: <p>I want to implement a like button (like in instagram, twitter etc) in my nativescript angular 2 app. clicking on the label should add the "active" class to the label. After clicking it again, it should remove the "active" class.</p>
  
  <p>home.component.html</p>
  
  <pre><code>&lt;label text="{{ post.likes }}" class="" (tap)="like()"&gt;
  </code></pre>
  
  <p>home.component.html (after clicking the label)</p>
  
  <pre><code>&lt;label text="{{ post.likes }}" class="active" (tap)="like()&gt;
  </code></pre>
  
  <p>home.component.ts</p>
  
  <pre><code>like() {
      if (/* post contains "active" class */) {
          // remove "active" class to label
      } else {
          // add "active" class to label
      }
  }
  </code></pre>