Angular2 No provider for ControlContainer when building a simple form

前端 未结 2 2096
情话喂你
情话喂你 2021-02-13 13:48

This is my form:

app.component.html

<
2条回答
  •  北恋
    北恋 (楼主)
    2021-02-13 14:46

    Alternatively you can use the existing form from the parent by adding this to the child component declaration.

    viewProviders: [{provide: ControlContainer, useExisting: NgForm}]
    

提交回复
热议问题