1. 程式人生 > >Angular表單報錯:Can't bind to 'ngModel' since it isn't a known property of 'input'. (")"

Angular表單報錯:Can't bind to 'ngModel' since it isn't a known property of 'input'. (")"

錯誤資訊:

core.js:1440 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. (")">
                    <input class="form-control" type="hidden" value="1"
                                id="dataId" name="dataId" [ERROR ->][(ngModel)]="data.dataId">
                    <div class="form-group row">
                        <label for="recommend" class="co"): ng:///SystemModule/

[email protected]:34
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("                    <input class="form-control" type="number" value="888"
                                id="recommend" name="recommend" [ERROR ->][(ngModel)]="data.recommend">
                        </div>

解決辦法:

在模型中加入FormsModule,

例如在system.module.ts中加入FormsModule,

...

import { FormsModule } from '@angular/forms';

...

@NgModule({
  imports: [
    ...
    FormsModule,
    ...
  ],
  declarations: [
   ...
  ]
})

export class SystemModule {}

相關推薦

AngularCan't bind to 'ngModel' since it isn't a known property of 'input'. (")"

錯誤資訊: core.js:1440 ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known prope

解決Angular Can't bind to 'ngModel' since it isn't a known property of 'input'

在input中使用[ngModel]報錯:Can't bind to 'ngModel' since it isn't a known property of 'input' 解決辦法:在module.ts中新增import和providers import { Ng

Angular: Can't bind to 'ngModel' since it isn't a known property of 'input'問題解決

當最初使用[(ngModel)]做雙向繫結時,如果遇見Angular: Can't bind to 'ngModel' since it isn't a known property of 'input'問題解決辦法:在你的app.module中新增如下程式碼即可:impor

npmnpm ERR! Maximum call stack size exceeded npm ERR! A complete log of this run can be found in

在npm下載包的時候出現一個錯誤: npm ERR! Maximum call stack size exceeded npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\安寧的小獅獅\

Apache啟動could not bind to address [::]:443 解決辦法

安裝Apache伺服器的時候,報如下錯誤: Installing the 'apache' service The 'apache' service is successfully installed. Testing httpd.conf.... Errors repo

Angular Can't bind to 'formGroup' since it isn't a known property of 'form'

ace 郵箱 rop ida providers remember block status clas 錯誤描述 當form表單加FormGroup屬性時報錯 Can‘t bind to ‘formGroup‘ since it isn‘t a known property

webpack 打包Can't resolve '.\dist\bundle.js' in 'E:\vivian....'

最近才開始學習webpack 用的webpack 版本是:4.20.2版本的,在打包過程用執行了這個命令 webpack .\src\main.js .\dist\bundle.js 然後就報了下邊的錯誤: 後來檢視之後原來是版本的問題,我用的這個wepa

在本地用 Navicat 連線遠端資料庫Can't connect to MySQL server on 。。。

在騰訊雲新買了一臺伺服器,環境都安裝好了,在本地用 Navicat 連線資料庫,就是連線不上,一直報錯Can’t connect to MySQL server on 。。。搞了三四個小時,終於搞定,分享一下過程。 一、檢查使用者授權 1.進入ubuntu

遠端連線CentOs7的mysqlCan't connect to MySQL server on 'x.x.x.x' (10060)

前提條件: 1.centos和windows的網路是互通的; 2.MySQL賦予了遠端連線的所有許可權 GRANT ALL PRIVILEGES ON *.* TO 'root' @ '%' IDENTIFIED BY 'myPassword' WITH GRANT OPTION;

SVNpermission denied SVNcan't open file db/txn-current-lock:permission denied 解決方法

SVN報錯:can't open file db/txn-current-lock:permission denied 解決方法 在Eclipse中使用SVN一開始的時候svn的安裝是root使用者進行安裝的(sudo apt-get

goland開啟終端can't open local terminal

幾分鐘之前都好好的,後來突然就無法在goland裡面開啟終端了。無論使用alt+f12還是通過view-tool window-terminal都無法解決。 當時開了好幾個視窗,也有說關掉再開,結果還是不行。 後來在一個技術群有大老提示:全部視窗關掉重啟試試? 好吧

MySQL連線Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

MySQL連線報錯:Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111) 報錯原因

使用seek()方法can't do nonzero end-relative seeks

python檔案操作中seek()方法:語法seek() 方法語法如下:fileObject.seek(offset[, whence])引數offset -- 開始的偏移量,也就是代表需要移動偏移的位元組數whence:可選,預設值為 0。給offset引數一個定義,表示要

Proguard打包混淆can't find superclass or interface

在Eclipse打包工程時報如下錯誤: [2014-01-06 08:58:44 - emp_android] Proguard returned with error code 1. See co

解決Jacksoncan not access a member of class xx.xx.ser.std.NullSerializer with modifiers "private"

                    解決 Jackson 報錯:can not access a member of class com.fasterxml.jackson.databind.se

flumeSpace for commit to queue couldn't be acquired. Sinks are likely not keeping up with sources

1.問題描述 自己採用flume監控log檔案,結果報錯 2018-11-26 19:32:04,687 (pool-5-thread-1) [ERROR - org.apache.flume.source.ExecSource$ExecRunnable.run(ExecSource.jav

jQuery提交 Uncaught TypeError: s[y] is not a function

使用jQuery提交表單的時候,頁面沒有反應,F12除錯發現點選提交按鈕,控制檯報錯 Uncaught TypeError: s[y] is not a function 問了百老師:發現可能是在form表單裡面 有一個input的id=“submit”,修改後,成功解決。

iOS 沒有檢視許可權the file "xxx.app" couldn't be opened because you don't have permission to view it.

iOS the file "xxx.app" couldn't be opened because you don't have permission to view it.問題解決方法彙總 (1) 最近重構專案,增加target來區分環境進行差異化編譯配置。 報

Angular 懶載入Error:Cannot find 'default' in 'xx/xx/xx.module'

前言     Angular日常採坑 在Angular中嘗試進行懶載入時,遇到以下錯誤: Error:Cannot find ‘defaut’in ‘xx/xx/xx’ 導致原因    在AppRo

ESCan not be imported as a dangling index as index with same name already exists in cluster me

解決方案: 你不應該直接刪除報警日誌中的.kibana index,因為可能會因此在kibana中丟失資料。假如你曾經刪除過 .kibana indice,那麼這個警告就是你過去那個刪除操作的殘留結果。 預設情況:kibana會 使用es的索引去儲存儲存