title: Enable one checkbox at a time in angular2
body: <p>I am generating multiple checkboxes dynamically using ngFor. But here i need to enable one checkbox at a time, <strong>if one is checked the other checkboxes need to be disabled. Similarly if i uncheck the checkbox other checkboxes need to be enabled</strong>. How to achieve this in angular2?</p>
  
  <pre><code>&lt;div class="col-12 mb-2" *ngFor="let option of question.options; let i = index;"&gt;
  &lt;input type="checkbox"
         [(ngModel)]="question.options[i].correct"
         [disabled]="!question.options[i].correct &amp;&amp; i != activeIndex"
         (ngModelChange)="copyQuestionmarks(i)"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In the code i am disabling the checkbox if its not a correct option and if that is not the active index. This works only for the first time, Suppose if i uncheck this other checkboxes won't get enabled.</p>
  
  <p>Below is my .ts code</p>
  
  <pre><code>public copyQuestionmarks(i: number) {
    this.activeIndex = i;
  }
  </code></pre>
  
  <p>Help appreciated!</p>