Open jvanharn opened 8 years ago
The problem is that you can't get the factory resolver in a later step, that's just how DI works.
SwapComponentDirective
is just a temp component until the official angular component is out, I think it's already merged... just need to wait for the version.
Anyway, the solution is to allow sending the factory not the component, I don't know yet still an early concept.
I'm submitting a ... [ x] bug report [ ] feature request [ ] question about the decisions made in the repository
What is the current behavior? Currently the SwapComponentDirective uses the component factory resolver from the RootModule of the application. Meaning that you cannot create a custom modal in an Sub-module, because it will be loaded in a "child" module, and the resolver wont find it (since it always looks in the root): https://github.com/shlomiassaf/angular2-modal/blob/master/src/angular2-modal/components/swap-component.directive.ts#L46
I have tried to fix it using "withComponents" and "forRoot" but they both did not fully resolve the issue, or in case of the last one, introduced side effects that were not ideal.
I have absolutely no idea how you could fix this, but if it is in fact unfixable, it may be a good idea to document it for simple souls like myself.
What is the expected behavior? I would expect to be able to include Modals in a sub/child-module and be able to call them in there. (If I include it in the entryModules and such.
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Angular version: 2.0.0-beta.X
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)