我得到了像不能绑定到'formGroup'这样的错误,因为它不是'form'的已知属性。但是我导入FormsModule,ReactiveFormsModule并在导入中声明但我遇到了同样的错误请任何人帮助我谢谢我的代码是:
<form [formGroup]="loginForm" (submit)="login()" class="md-form-auth form-validation" (keypress)="keyDownFunction($event)">
<fieldset>
<div class="form-group">
<md-input-container class="full-width md-icon-left">
<md-icon class="material-icons">mail_outline</md-icon>
<input mdInput type="email" placeholder="Email"
formControlName="Username">
</md-input-container>
</div>
<div class="form-group">
<md-input-container class="full-width md-icon-left">
<md-icon class="material-icons">lock_outline</md-icon>
<input mdInput type="password" placeholder="Password"
formControlName="Password">
</md-input-container>
</div>
<button [disabled]="!loginForm.valid" md-raised-button type="button" color="primary" class="float-right">
Login
</button>
</fieldset>
</form>