I have a class that uses an instance of DialogService from 'aurelia-dialog` to open almost every dialog in my Aurelia application. In a very abstract way the class looks like this:
export class DialogTrigger{
triggerDialogA() {...}
triggerDialogB() {...}
triggerDialogC() {...}
}
Everything works fine until I try to inject DialogTrigger to one of the dialogs.
So let's say that I want to create a new dialog, DialogD. I simply add another method triggerDialogD() in DialogTrigger that opens a new dialog with a DialodD view model and everything works. But if I want my new dialog to also trigger one of the other dialogs (A,B or C) by using an instance of DialogTrigger everything falls apart.
If I inject DialogTrigger into DialogD I always get an error:
key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
If I remove the dependency, the dialog works.
TL;DR
I have a DialogTrigger class that opens aurelia-dialogs. DI fails when I inject DialogTrigger to any dialog instantiated by it.
Any ideas?