Angular 4 - ngModel表达式为数字

时间:2018-05-23 09:07:19

标签: angular

是否可以将ngModel的表达式设置为数字?像这样:

  

[(ngModel)] = “coeffHour.01”

有了这个,我有以下错误:

  

分析器错误:[coeffHour.01]中第10列的意外标记'0.01',ng:///AdministrationModule/CoefficientsHourComponent.html@27:48(“name =”01“required type =”number“min = “0”步=“0.1”                              formControlName =“01”[错误 - >] [(ngModel)] =“coeffHour.01”>

提前致谢!

1 个答案:

答案 0 :(得分:0)

[(ngModel)]不会包含数字。

您需要使用它:

[(ngModel)]="coeffHour[01]"