title: Ionic 3 Reactive Forms in IonViewDidLoad or ionViewWillEnter not working
body: <p>Ionic 3 Reactive Form is not working in IonViewDidLoad or ionViewWillEnter. It says</p>
  
  <pre><code>UserInfoPage.html:18 ERROR TypeError: this.form._updateTreeValidity is not a function
  </code></pre>
  
  <p>Whereas if I put form builder code in the Ionic Page's constructor then it says</p>
  
  <pre><code>UserInfoPage.html:23 ERROR TypeError: Cannot read property 'dateOfBirth' of undefined
  </code></pre>
  
  <p>I am using Lazy Loading for the form page. Please help and guide. Here's the complete code:</p>
  
  <p><strong>user-info.ts:</strong></p>
  
  <pre><code>export class UserInfoPage {
  
    createForm(): any {
      this.userInfoForm = this.fb.group({
        dateOfBirth: [ '', Validators.compose([Validators.required, Validators.pattern(new RegExp("(0[123456789]|10|11|12)([/])([1-2][0-9][0-9][0-9])"))]) ],
        weight: [ '', Validators.required, Validators.compose([Validators.pattern(new RegExp("[0-9]*"))]) ],
        height: [ '', Validators.required, Validators.compose([Validators.pattern(new RegExp("[0-9]*"))]) ],
      });
    }
  
    @ViewChild("userInfoForm") content: Content;
  
    userInfoForm: FormGroup;
    isFormLoaded: boolean;
  
    constructor(public navCtrl: NavController, private fb: FormBuilder, public navParams: NavParams) {
      this.isFormLoaded = false;    
    }
  
    ionViewWillEnter() {
      this.createForm();
      this.isFormLoaded = true;
      this.content.resize();    
    }
  
  }
  </code></pre>
  
  <p>and </p>
  
  <p><strong>user-info.html:</strong></p>
  
  <pre><code>&lt;ion-content #userInfoForm&gt;
    &lt;form [formGroup]="userInfoForm" *ngIf="isFormLoaded"&gt;
      &lt;ion-list&gt;
        &lt;ion-list-header&gt;Please Enter Your Following Information&lt;/ion-list-header&gt;    
        &lt;ion-item&gt;
          &lt;ion-label color="primary" floating&gt;Date of Birth&lt;/ion-label&gt;
          &lt;ion-input [formControl]="userInfoForm.controls['dateOfBirth']" required&gt;&lt;/ion-input&gt;
        &lt;/ion-item&gt;
        &lt;ion-item&gt;
          &lt;ion-label color="primary" floating&gt;Weight&lt;/ion-label&gt;
          &lt;ion-input [formControl]="userInfoForm.controls['weight']" type="number" pattern="[0-9]*" required&gt;&lt;/ion-input&gt;
        &lt;/ion-item&gt;
        &lt;ion-item&gt;
          &lt;ion-label color="primary" floating&gt;Height&lt;/ion-label&gt;
          &lt;ion-input [formControl]="userInfoForm.controls['height']" type="number" pattern="[0-9]*" required&gt;&lt;/ion-input&gt;
        &lt;/ion-item&gt;
      &lt;/ion-list&gt;
    &lt;/form&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>ionic and angular newbie here. Thanks.</p>