0

a todos tengo este problema pero revisando en otros foros de esta misma paguina web. La solucion aparante es importar el FormsModule en app.module.ts

Adjunto mi codigo - app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { FormsModule } from '@angular/forms';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,

  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

login.component.html

 <div class="col-12">
                                <div class="single_billing_inp">
                                    <label>Email Address <span>*</span></label>
                                    <input type="email" [(ngModel)]="email" placeholder="[email protected]">
                                </div>
                            </div>
                            <div class="col-12">
                                <div class="single_billing_inp">
                                    <label>Password <span>*</span></label>
                                    <input type="password" [(ngModel)]="password" placeholder="type password">
                                </div>
                            </div>

Cual seria la solucion?

1 respuesta 1

0

Despues de horas de tratar buscar la solucion la encontre. Si esta bien que se importe FormsModules dentro de app.module.ts.

No obstante, se debe importar el FormsModules tambien en el modules.ts de los componentes que estas usando ngmodule. A continuacion un ejemplo:

Iamgen1

Como se puede ver en este componente tambien existe el auth-profile.component.module.ts y este tambien se debe importar FormsModules

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { AuthProfileRoutingModule } from './auth-profile-routing.module';
import { AuthProfileComponent } from './auth-profile.component';
import { LoginComponent } from './login/login.component';
import { SharedModule } from 'src/app/shared/shared.module';
import { RegisterComponent } from './register/register.component';
import { FormsModule } from '@angular/forms';


@NgModule({
  declarations: [
    AuthProfileComponent,
    LoginComponent,
    RegisterComponent
  ],
  imports: [
    CommonModule,
    AuthProfileRoutingModule,
    SharedModule,
    FormsModule,
  ]
})
export class AuthProfileModule { }

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.