Angular4のチュートリアルにてFormsModuleのインポートにてエラーが取れません。
よろしくお願いします。
<エラー内容> 'ngModel'は 'input'の既知のプロパティではないため、バインドできません。 ( " <div> <label> name:</ label> <input [ERROR - >] [(ngModel)] = "selectedHero.name"プレースホルダー= "name" /> </ div> </ div> "):
テンプレート部分 <div> <label>name: </label> <input [(ngModel)]="hero.name" placeholder="name"> </div>
<app.module.ts> import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; // <-- NgModel lives here import { AppComponent } from './app.component'; @NgModule({ imports: [ BrowserModule, FormsModule // <-- import the FormsModule before binding with [(ngModel)] ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { }
あなたの回答
tips
プレビュー