I’m using ionic 6.10.2 and i’m trying to use ngModel importing FormsModule in the module and it always answers undefined in the input variables asigned.
module
@NgModule({
declarations: [
RoutingLayoutComponent,
LoginComponent,
RegisterComponent,
LoadingComponent,
BackButtonComponent
],
imports: [
CommonModule,
FormsModule,
IonicModule
],
exports: [
RoutingLayoutComponent,
LoginComponent,
RegisterComponent,
LoadingComponent,
BackButtonComponent
]
})
export class ComponentsModule { }
component
@Component({
selector: ‘app-login’,
templateUrl: ‘./login.component.html’,
styleUrls: [’./login.component.scss’],
})
export class LoginComponent implements OnInit {
public data: any;
constructor(
private routing: RoutingService,
private auth: AuthService) {
this.data = {};
this.data.email = ‘’;
this.data.password = ‘’;
}
Html input
<ion-input type=“text” [(ngModel)]=“data.email”>