I'm very new to Angular.

I want to load a child component conditionally within a component by clicking button. On button click, it should re-render the respective child component.

**HTML code**

```
<div class="tab">
  <button class="tablinks" (click)="onTabClick('0')">Transmit</button>
  <button class="tablinks" (click)="onTabClick('1')">Published</button>
  <button class="tablinks" (click)="onTabClick('2')">Bulk Transmit</button>
</div>
<div>
  <app-sports  *ngIf="tabIndex === 0"></app-sports>
  <app-movies  *ngIf="tabIndex === 2"></app-movies>
</div>

```

**TS file**

```
tabIndex = 2 ;

  onTabClick(index){
        this.tabIndex = index;
   }

```