数字输入的ngModel

时间:2017-09-19 02:20:59

标签: angular typescript ionic3

我想将数字输入的输入绑定到我的打字稿文件中的变量。我认为ngModel是合适的并且输入:<input [{ngModel}]="tRating" type="number" min="1" max="10"> tRating是.ts文件中的类型编号。不幸的是我收到了错误:

Can't bind to '{ngModel}' since it isn't a known property of 'input'. ("   
        <input [ERROR ->][{ngModel}]="pRating" type="number" min="1" max="10">

2 个答案:

答案 0 :(得分:2)

您需要将 Sub trial() Dim wb As Workbook, wb2 As Workbook, wb3 As Workbook Dim fn As String Set wb = ActiveWorkbook With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = False If .Show = -1 Then fn = .SelectedItems(1) Set wb2 = Workbooks.Open(fn) Else MsgBox "You cancel the process." Exit Sub End If End With Dim ws As Worksheet wb2.Activate Application.DecimalSeparator = "," Application.ThousandsSeparator = "." Application.UseSystemSeparators = True Sheets(1).AutoFilterMode = False Sheets(1).Range("$A$9:$P$417").AutoFilter Field:=5, Criteria1:= _ "1,000,000" Range("F31:F804").Select Selection.Copy wb.Activate 'determine the sheet you want to copy to and search for the next empty row 'change the commas to dot as well Sheets(2).Activate Dim FirstCell As String Dim i As Integer FirstCell = "D19" Range(FirstCell).Select Do Until ActiveCell.Value = "" If ActiveCell.Value = "" Then Exit Do Else ActiveCell.Offset(1, 0).Select End If Loop Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True wb2.Activate Range("D31:D804").Select Application.CutCopyMode = False Selection.Copy wb.Activate 'determine the sheet you want to copy to and search for the next empty row Sheets(3).Activate FirstCell = "D19" Range(FirstCell).Select Do Until ActiveCell.Value = "" If ActiveCell.Value = "" Then Exit Do Else ActiveCell.Offset(1, 0).Select End If Loop Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True wb2.Activate Range("G31:G804").Select Application.CutCopyMode = False Selection.Copy wb.Activate 'determine the sheet you want to copy to and search for the next empty row Sheets(4).Activate FirstCell = "D19" Range(FirstCell).Select Do Until ActiveCell.Value = "" If ActiveCell.Value = "" Then Exit Do Else ActiveCell.Offset(1, 0).Select End If Loop Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True wb2.Close End Sub 导入app.module.ts

FormsModule

并且语法应为 import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @NgModule({ imports: [ FormsModule ], 而不是 [(ngModel)]

[{ngModel}]

答案 1 :(得分:-1)

如果你使用ngForm,

&#13;
&#13;
<form #f="ngForm" (ngSubmit)="onSubmit(f)" novalidate>
  <input name="tRating" ngModel required #tRating="ngModel">
....
&#13;
&#13;
&#13;