title: How to create Angular 2+ toggle for multiple buttons?
body: <p>Hello I need to create toggle buttons, but when I click first button active class works for both element.</p>
  
  <p>HTML</p>
  
  <pre><code> &lt;button [class.active]="k" (click)="toggle()"&gt;1&lt;/button&gt;
   &lt;button [class.active]="k" (click)="toggle()"&gt;2&lt;/button&gt;
  </code></pre>
  
  <p>TS</p>
  
  <pre><code>k: boolean = false;
  toggle(): void {
     this.k = !this.k;
  }
  </code></pre>