This is my form:
app.component.html
<form [ngFormModel]="myForm">
<my-child-component></my-child-component>
</form>
app.component.ts
constructor ( private _formBuilder : FormBuilder ) {
this.myForm = _formBuilder.group( {
firstName : ["",Validators.required]
} );
}
my-child-component:
<input type="text" ngControl="firstName">
Error:
No provider for ControlContainer
[ERROR ->]<md-input
ngControl="firstName"
placeholder="First name">
If I move the input inside the app component itself, it'll work, but my input is inside a child component.
FORM_DIRECTIVES
and FORM_PROVIDERS
are being injected at the top app level. I've done exactly everything as per their guides.
I also tried adding FORM_DIRECTIVES
to the child or to app.component with no success.