我有一个自定义表单和自定义输入。
我正在尝试将自定义表单注入自定义输入。当输入是表单的直接子级时,它可以工作,但是,当我在它们之间有一个组件时,它会引发异常。
这有效:
AppComponent.html:
<custom-form>
<custom-input></custom-input>
</custom-form>
这不起作用:
AppComponent.html:
<custom-form>
<some-component></some-component>
</custom-form>
一些组件的html:
<custom-input></custom-input>
CustomInput 构造函数:
CustomInput(@Optional() CustomForm form);
我收到错误异常:未找到 CustomForm 的提供程序。