Search code examples
angular6angular-reactive-formsform-controlformarray

Why Angular ReactiveForms FormArray throws error "TypeError: Cannot read property 'updateOn' of null"


Hello All I have a Formarray which which has set of Roles. During Edit it dynamically removes & adds roles in that form array till here all works fine, but when i submit the form it thorws error & the page gets refresh.

Error : TypeError: Cannot read property 'updateOn' of null

Also I am attaching the screen shot belowenter image description here


Solution

  • it is worked for Me

    Make sure you have put <button type="button" ></button> instead of <input type="submit" />

    <button [ngClass]="(this.editMemberForm.invalid?'a1':'')" type="button" class="btn btn-success" (click)="saveData()">Save</button>