我在输入中绑定ngModel时遇到错误

时间:2018-07-18 14:26:14

标签: angular angular-ngmodel ngmodel

将ngModel绑定到输入时,我发现以下错误-

Can't bind to 'ngModel' since it isn't a known property of 'input'. ("<div>
<span> Select : </span>
<input type="radio" name="options" value="all" [ERROR ->][(ngModel)]="SelectRadioButtonValue" (change)="onRadioButtonSelectionChanged()"  />
<span> {{"All: " "): ng:///AppModule/EmpCountComponent.html@2:47
Can't bind to 'ngModel' since it isn't a known property of 'input'. (">
<span> {{"male: " + '(' + male + ')' }} </span>
<input type="radio" name="options" value="female" [ERROR ->][(ngModel)]="SelectRadioButtonValue"   (change)="onRadioButtonSelectionChanged()" />
<span> {{"Female"): ng:///AppModule/EmpCountComponent.html@6:50

1 个答案:

答案 0 :(得分:0)

要使用.dialogTitle { display: flex; justify-content: space-between; align-items: center; } ,应将[(ngModel)]导入您的FormsModule

AppModule