リファレンスのチュートリアルをやっています。
双方向データバインディングをするために以下のようにしたところ、
<input [(ngModel)]="hero.name" placeholder="name">
エラーになったため、
Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'.
この記事を参考にFromModule
をインプットしたのですが、NgModule
が見つからないとエラーになってしまいました。
どのように設定すれば、バインディングできるでしょうか?
ご回答よろしくお願いします。
/app/hero/hero.component.ts
javascript
1import { FormsModule } from '@angular/forms'; 2 3@NgModule({ 4 imports: [FormsModule] 5})
ターミナル上のエラー ERROR in src/app/hero/hero.component.ts(5,2): error TS2304: Cannot find name 'NgModule'.
ブラウザのコンソール上のエラー
hero.component.ts:14 Uncaught ReferenceError: NgModule is not defined at hero.component.ts:14 at Object../src/app/hero/hero.component.ts (hero.component.ts:26) at __webpack_require__ (bootstrap:76) at Object../src/app/app.module.ts (app.component.ts:8) at __webpack_require__ (bootstrap:76) at Object../src/main.ts (environment.ts:15) at __webpack_require__ (bootstrap:76) at Object.0 (main.ts:12) at __webpack_require__ (bootstrap:76) at checkDeferredModules (bootstrap:43)

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/05 10:42