I am new to angular. I am dynamically rendering some fields into my reactive form. Everything works great when I am using ng serve with a mock request (i.e. rendering happens properly, no error in the console.log). As soon as I build the project with ng build and use a proper backend, I get the error for each field I am rendering dynamically: main.js:1 ERROR TypeError: Cannot read property '_rawValidators' of null I couldn't find any background on this error. I would love to hear your thoughts. more background // these fields change with selection this.datafields = [{ dfId: 48, dfName: "Phone", dfType: "text", dfOptions: null, dfValue: "" }, { dfId: 49, dfName: "Eval", dfType: "select", dfOptions: ["","Remote","Live"], df_value: "", }] typescript rendering in ngOnInit (tried ngAfterViewInit with no improvement) dfGroup = new FormGroup({}) ... ... this.eyeForm = this.formBuilder.group({ focus: ['', Validators.required], datafields: this.formBuilder.array([]) }) ... ... if (this.datafields != null || this.datafields != undefined) { this.datafields.forEach((x:any) => { this.dfGroup.setControl(x.dfName, new FormControl(x.dfValue)); }); this.getDataFields.push(this.dfGroup); } and HTML looks like the following: <div [formGroup]="dfGroup"> <div class="row pt-2" *ngFor="let field of datafields; let i=index"> <div class="col-4 d-flex align-items-center 13required"> {{field.dfName}} </div> <div class="col-6"> <mat-form-field *ngIf="field.dfType == 'text'" appearance="outline"> <input matInput [type]="field.dfType" [formControlName]="field.dfName" required /> </mat-form-field> <mat-form-field *ngIf="field.dfType == 'select'" appearance="outline" > <mat-select [formControlName]="field.dfName" placeholder=""> <mat-option [value]="option" *ngFor="let option of field.dfOptions" > {{ option }} </mat-option> </mat-select> </mat-form-field> </div> </div> </div> Continue reading...