I am new at Angular and trying to make dynamic forms with JSON data. The conditions should be selected from the options type selection from the JSON data. I have tried the following code but it does not work

```
<mat-card class="rahmendaten-container">
  <h3 class="page__header">{{stepCfg.stepHeading}}</h3>
  <div *ngIf="!!stepCfg.htmlContent" [innerHTML]="stepCfg.htmlContent"> 
  </div>
  <form [formGroup]="form" autocomplete="off" (ngSubmit)="onSubmit()">
    <mat-card-content class="page">
      <div class="page__container">
        <div *ngFor="let prop of formTemplate" class="container__row">
          <div [ngSwitch]="prop.type">
            <div *ngSwitchCase="'select'">
              <span [innerHTML]="prop.label" 
              class="container__row__label"></span>
              <mat-form-field>
                <mat-select [formControlName]="onChange($event,prop)" 
                [formControlName]="values[prop.label + i]">
                  <mat-option *ngFor="let option of prop.options" 
                  [value]="option.value">{{option.label}}</mat-option>
                </mat-select>
              </mat-form-field>
            </div>
          </div>
        </div>
      </div>
    </mat-card-content>
  </form>
</mat-card>

```

Type script

```
import { Component, OnInit } from '@angular/core'; 
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { MatDialog, MatDialogRef } from '@angular/material';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent implements OnInit {
    form:FormGroup;
    array: any[] = [];
    selectItems: any;
    formTemplate:any = form_template;
    stepCfg = {
      stepType: 'rahmendaten',
      stepHeading: '',
      stepIndex: 0,
      steps: [],
      firstStep: false,
      lastStep: false,
      onlyStep: false,
      data: {},
      htmlContent: ''
    };
    formDataObj = {};

  constructor() {}   

  ngOnInit() {
    for (const prop of Object.keys(this.stepCfg.data)) {
      this.formDataObj[prop] = new 
      FormControl(this.stepCfg.data[prop].value);
      this.formTemplate.push({
        key: prop,
        label: this.stepCfg.data[prop].label,
        type: this.stepCfg.data[prop].type,
        options: this.stepCfg.data[prop].options
      });
   }
   this.form = new FormGroup(this.formDataObj);
  }

  onChange(evt) {

    this.formTemplate.forEach(prop => {
      let options = prop.options.filter(x => x.value == evt)[0]
      var allLabels: string[] = this.formTemplate.map(x => x.label)

      if (options) {
        if (options.subfield && 
        !allLabels.includes(options.subfield.label)) {
          let obj = { ...options.subfield }
          this.formTemplate.push(obj)
        }
      }
    })
  }
}

 const form_template = [{
  "type": "select",
  "label": "Test1",
  "options": [
  {
      "value": "sped1",
      "label": "A Test GmbH",
      "subfield": {
        "type": "select",
        "label": "Subfield1",
        "options": [
          {
            "value": "subfieldvalue1",
            "label": "101"
          },
          {
            "value": "subfieldvalue1",
            "label": "101"
          },
        ]
       }
  },
  {
      "value": "sped2",
      "label": "Test2 GmbH"
  },
  {
     "value": "sped3",
     "label": "test3"
  },
  ]
}

```

]
 export default form\_template

After getting the valueable help from @AdritaSharma; I havr tried this but it do not work.