Reputation: 4918
I have a custom form and custom input.
I am trying to inject the custom form into the custom input.
It works when the input is a direct child of the form, however, when I have a component between them, it throws an exception.
this works:
The AppComponent.html:
<custom-form>
<custom-input></custom-input>
</custom-form>
this doesn't work:
The AppComponent.html:
<custom-form>
<some-component></some-component>
</custom-form>
The some-component html:
<custom-input></custom-input>
the CustomInput constructor:
CustomInput(@Optional() CustomForm form);
I am getting the error EXCEPTION: No provider found for CustomForm.
Upvotes: 0
Views: 1461
Reputation: 8614
A couple things:
It's possible you found a bug. If you can create a reproduction case on github or getter, and create an issue, I can follow-up on why/why not this is working, and why @Optional()
isn't preventing an exception.
That being said, this is pretty fundamental to Angular working, so I'd be confused why this doesn't work but injection does work in other cases.
What version of AngularDart are you using? Any special flags?
Upvotes: 1