Reputation: 3805
I am getting this error. I have searched the google and it suggested me to add FormsModule to app.module.ts. Though i did that i am not able to solve the problem.Can someone help me out from this
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.html
<input type="text" [{ngModel}]="name" />
<p>
{{name}}
</p>
Upvotes: 0
Views: 4860
Reputation: 6942
correct your template
<input type="text" [(ngModel)]="name" />
instead of
<input type="text" [{ngModel}]="name" />
Upvotes: 1
Reputation: 60596
The syntax for your two-way binding is not correct. This
[{ngModel}]
Should be this:
[(ngModel)]
Use parentheses instead of curly braces. The trick here is to think: banana in a box where the banana is the () and the box is the [].
Upvotes: 1