0

here is the component.html <input [(ngModel)]="email" (keyup.enter)="onKeyUp()"> here is the error: Can't bind to 'ngModel' since it isn't a known property of 'input'.

here is my app.module where is imported and added FormsModule

import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';

import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { CoursesServices } from './courses.services';
import { CustomerComponent } from './customer/customer.component';

@NgModule({
  declarations: [
    AppComponent,
    CustomerComponent
  ],
  imports: [
    BrowserModule,
    FormsModule
  ],
  providers: [CoursesServices],
  bootstrap: [AppComponent]
})
export class AppModule { }
5
  • has you "re-start" the ng serve? Commented Aug 22, 2023 at 10:18
  • Try to add [ngModelOptions]="{standalone: true}" with ngModel Commented Aug 22, 2023 at 10:21
  • yes I restarted ng serve but didn't help Commented Aug 22, 2023 at 10:38
  • Are you using import { NgModel } from '@angular/forms'; inside your .component.ts? Commented Aug 22, 2023 at 10:43
  • yes, but the error is still there Commented Aug 22, 2023 at 11:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.