title: Add class name click items in loop *ngFor Angular 2
body: <p>I'm running into a problem with add class name based on the Angular 2 ngFor loop index. using ngFor creating multiple button, when i click button add class in the specific button. like tag select For your reference <a href="http://www.jqueryscript.net/demo/Simple-Mobile-Friendly-jQuery-Tags-Input-Plugin-Taxonomy/" rel="nofollow noreferrer">Link</a></p>
  
  <pre><code>&lt;button color="light" *ngFor="let category of categories" [class.tagactive]='stateOfButton' (click)="changeState(i)" let i = index;&gt;{{category}} &lt;span (click)="delete(i)"&gt;X&lt;/span&gt;&lt;/button&gt;
  
      stateOfButton: boolean = false;
      categories = ['Windstorm', 'Bombasto', 'Magneta', 'Tornado', 'mango'];
      changeState(index) {
          this.stateOfButton = !this.stateOfButton;
      }
      delete(index) {
        this.categories.splice(index, 1);
      }
  
  .tagactive { background: #cc3333; color:#fff;}
  </code></pre>