-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Description
Hi,
Why should we pass a ResolvedProvider[]to DynamicComponentLoader.loadNextToLocation instead of an Injector ?
I'm writing a small dialog system and I have a DialogService.open method which uses DynamicComponentLoader.loadNextToLocation to load a component inside the dialog. All is working fine until the loaded component asks for providers.
I can add a providers parameters to the DialogService.open method but it means that the user have to explicitly make something like this :
@Component({
selector: 'my-app',
providers: [DialogService]
})
class AppComponent {
constructor(dialogService:DialogService) {
var providers = Injector.resolve([
FakeService
]);
dialogService.open(MyDialogContentComponent, providers);
}
}I would like to let the dialogService use the injector of the AppComponent and let the possibility to do something like this :
@Component({
selector: 'my-app',
providers: [DialogService, FakeService]
})
class AppComponent {
constructor(dialogService:DialogService) {
dialogService.open(MyDialogContentComponent);
}
}What's the best way to do this ?
Thanks
QuentinFchx and dharness
Metadata
Metadata
Assignees
Labels
No labels