FormBuilder error "this.form._updateTreeValidity is not a function"

I’m attempting to follow the Ionic 2 and Forms instructions and get the error:

this.form._updateTreeValidity is not a function

which my app is not calling directly, and in fact don’t see my app in the stack at all.

login.ts:

 ionViewLoaded() {
    this.loginForm = this.formBuilder.group({
      email: ['', Validators.required],
      password: ['', Validators.required],
    });
  }

  login() {
    console.log("Get rosters");
  }

And login.html:

<form [formGroup]="loginForm" (ngSubmit)="login()">
	<ion-item>
		<ion-label>Email address</ion-label>
		<ion-input type="email" formControlName="email"></ion-input>
	</ion-item>
	<ion-item>
		<ion-label>Password</ion-label>
		<ion-input type="password" formControlName="password"></ion-input>
	</ion-item>
	<button ion-button type="submit" [disabled]="!loginForm.valid">Submit</button>
</form>
1 Like

This error disappeared at some point was replaced with a problem that the formGroup wasn’t set. I eventually discovered that with a Modal, it’s necessary to create the formGroup in the constructor, not in ionViewDidLoad.

2 Likes