title: Angular: Toggle active class on only button the current clicked button (not using *ngFor)
body: <p>I'm trying to figure out how can I toggle the <code>active</code> class on <strong>only the clicked button</strong>:</p>
  
  <p>This is my current code...</p>
  
  <pre><code>&lt;div class="btn-group"&gt;
    &lt;button class="btn btn-secondary" [ngClass]="{ 'active' : isActive }" (click)="isActive = !isActive" type="button"&gt;Premier bouton&lt;/button&gt;
    &lt;button class="btn btn-secondary" [ngClass]="{ 'active' : isActive }" (click)="isActive = !isActive" type="button"&gt;Second bouton&lt;/button&gt;
    &lt;button class="btn btn-secondary" [ngClass]="{ 'active' : isActive }" (click)="isActive = !isActive" type="button"&gt;Troisième bouton&lt;/button&gt;
    &lt;button class="btn btn-secondary" [ngClass]="{ 'active' : isActive }" (click)="isActive = !isActive" type="button"&gt;Quatrième bouton&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>...and this is the result:</p>
  
  <p><a href="https://i.stack.imgur.com/s5SVs.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/s5SVs.gif" alt="enter image description here"></a></p>
  
  <p>I <strong>DO NOT USE</strong> <code>*ngFor</code> or <code>ng-repeat</code> principle. I know I need to <strong>isolate</strong> each button. How can I do that?</p>
  
  <p>Adding <code>this.</code> to <code>isActive</code> doesn't work: <code>this.isActive</code>.</p>