亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法綁定到“ngModel”,因為它不是“輸入”的已知屬性

無法綁定到“ngModel”,因為它不是“輸入”的已知屬性

FFIVE 2019-07-19 10:21:17
無法綁定到“ngModel”,因為它不是“輸入”的已知屬性我在啟動我的角度應用程序時有以下錯誤,即使組件沒有顯示。我要評論一下<input>這樣我的應用程序就能工作了。    zone.js:461 Unhandled Promise rejection: Template parse errors:     Can't bind to 'ngModel' since it isn't a known property of 'input'. ("         <div>             <label>Created:</label>             <input  type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" />         </div>     </div>"): InterventionDetails@4:28 ; Zone: <root> ; Task: Promise.then ; Value:我在看英雄柱塞,但我沒有看到與我的代碼有任何區別。以下是組件文件:    import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';     import { Intervention } from '../../model/intervention';     @Component({         selector: 'intervention-details',         templateUrl: 'app/intervention/details/intervention.details.html',         styleUrls: ['app/intervention/details/intervention.details.css']     })     export class InterventionDetails     {         @Input() intervention: Intervention;         public test : string = "toto";     }
查看完整描述

3 回答

?
慕萊塢森

TA貢獻1810條經驗 獲得超4個贊

是的,就是這樣,在app.module.ts中,我只是補充道:

import { FormsModule } from '@angular/forms';[...]@NgModule({
  imports: [
    [...]
    FormsModule
  ],
  [...]})


查看完整回答
反對 回復 2019-07-19
?
月關寶盒

TA貢獻1772條經驗 獲得超5個贊

為了能夠對表單輸入使用雙向數據綁定,您需要導入FormsModule你的包裹Angular模塊。


查看完整回答
反對 回復 2019-07-19
  • 3 回答
  • 0 關注
  • 807 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號