Type 'Event' is not assignable to type 'string'

Viewed 1040

I'm new to angular and I was following this hero tutorial when I stumbled upon this error:

Type 'Event' is not assignable to type 'string'

I reproduced the error here.

1 Answers

You are missing the FormsModule import in your AppModule.

import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";
import { AppComponent } from "./app.component";
import { HeroComponent } from "./hero/hero.component";

@NgModule({
  imports: [BrowserModule, FormsModule],
  declarations: [AppComponent, HeroComponent],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
Related