I'm just getting started with angular material 2.
So i started with <md-form-filed>
.
I'm trying to use formBuilder inside .
Here goes my formBuilder code :
constructor(private _formBuilder : FormBuilder ) {
this.loginForm = this._formBuilder.group({
'email' : [''],
'password' : ['']
});
}
and in my html :
<md-card>
<md-card-title>
Login
</md-card-title>
<md-card-content>
<ng-container>
<form [formGroup]="loginForm" (ngSubmit)='Login(f.value)'>
<md-form-field >
<input mdInput [formControl]="loginForm.controls['email']" placeholder='Email' required>
</md-form-field>
</form>
</ng-container>
</md-card-content>
</md-card>
I'm getting this error in my console : md-form-field must contain a MdFormFieldControl. Did you forget to add mdInput to the native input or textarea element?
What am i doing wrong ?
Thanks in advance