ark
ark

Reputation: 3805

Uncaught Error: Template parse errors:

enter image description here

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

Answers (2)

Hamed Baatour
Hamed Baatour

Reputation: 6942

correct your template

<input type="text" [(ngModel)]="name" />

instead of

<input type="text" [{ngModel}]="name" />

Upvotes: 1

DeborahK
DeborahK

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

Related Questions