I am trying to create a simple form by following this tutorial but i am getting following error:
Can't bind to 'ngModel' since it isn't a known property of 'input'.
this is my html HomeComponent:
Pokemon Name: <input type="text" [(ngModel)]="pkname">
<button mt-raised-button>Search</button>
this is my views module
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { FormsModule } from '@angular/forms'
import { HomeComponent } from 'src/app/views/home/home.component'
@NgModule({
imports: [CommonModule,FormsModule],
exports: [HomeComponent],
declarations: [HomeComponent]
})
export class ViewModule {}
I've also imported FormsModule in my app.module
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http'
import { FormsModule } from '@angular/forms'
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
HttpClientModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }