Reactive form doesnt works as expected

Hello,

Another issue, reactive form doesn’t works.

<form [formGroup]="registerForm" (ngSubmit)="register()" novalidate>
          <ion-item lines="full">
            <ion-label position="floating">Nom</ion-label>
            <ion-input type="text" required formControlName="lastname"></ion-input>
          </ion-item>
</form>


    this.registerForm = this.formBuilder.group({
      lastname: ['', Validators.required]
    });

And when i execute :

ERROR Error: Uncaught (in promise): Error: No value accessor for form control with name: 'lastname'
Error: No value accessor for form control with name: 'lastname'

Basic usage as i can see on doc or example (https://www.positronx.io/ionic-form-validation-tutorial/).

Ionic/angular : 5
Angular : 10
Ionic/Angular-toolkit : 2.3

If the page containing this code is in a lazily-loaded module, does its module import FormsModule and ReactiveFormsModule?

Yes both of them are imported… Still not working

Then I believe your problem lies outside what you’ve posted so far, because I copied it into the app component of a scratch project and it behaved without error.

I just created a new app, and add a form, it’s ok…

Visibly there is a problem with “CoreModule” to manage “global module dependencies”.

Import/Export module in app module doesn’t work in Ionic App ?

Should work like any other Angular app. Personally, I have yet to come across a situation where lazy module loading was deemed worth the massive headache of managing it, so I simply don’t use it. I declare all components, pages, and services in a single AppModule.

I always use lazy loading, and for example, if i have a CoreModule who import/export ReactiveFormsModule, and my app module import/export CoreModule my other modules should can use “ReactiveFormsModule” right ?

Btw thanks for your answer