Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’

Nao Kawakami
Aug 21, 2021
// error at app.component.html<input [(ngModel)]='title' placeholder="title">
<p>{{title}}</p>

Lisasin FormsModule app.module.ts

// app.module.tsimport { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, } from '@angular/forms';
@NgModule({
declarations: [
AppComponent,
]
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
],
providers: [],
bootstrap: [AppComponent]
})

--

--