I want to add a div on click of button, and it should have 1 did added by default and on newly added div i need a class active on it
 <div class="card-content">
    <div class="questions" *ngFor="let question of questions, let i = index" [ngClass]="{'active': i}">
      <app-question-card></app-question-card>
    </div>
  </div>
  <div class="footer" (click)="addNewQuestion()">
    <div class="running-txt">Add new question</div>
  </div>
questions: number[] = [1];
addNewQuestion() {
    this.questions.push(this.questions.length);
  }
the add is working as expected but the class is not getting appended the way it should and it is not getiing removed from 1 default added div as well any idea?

activeappended, just add it asclass="active". Your expression[ngClass]="{'active': i}means add classactiveifiis truthy (meaning the first item will not have it asiis0in that case).