aurelia-di

Passing the parent when parent is the same component type in Aurelia

*爱你&永不变心* 提交于 2019-12-10 17:45:30
问题 Edit: This question used to be titled "Getting parent via DI when parent is the same type in Aurelia" but due to how my elements are nested, it makes more sense to just bind the parent to the element, so the title has been changed to reflect this. If I have a custom element, Thing which has a child Thing (which has a another child Thing , etc), how can I inject the parent instance when the class is the same? export class Thing { static inject = [Thing]; // <-- no reference to Thing as we are

Create a new instance of a class that is using dependency injection in Aurelia

余生长醉 提交于 2019-12-07 14:45:26
问题 I want to create a factory that is able to create a new instance of a class (MyClass, implementing an abstract class) that is using dependency injection. I would like the factory to look like this: Factory export class Factory { public static makeMyClass() { return new MyClass(); } } However, the EventAggregator is not injected into MyClass when I take this approach. How can I do this? Interface export abstract class MyClassInterface { abstract connect(); abstract disconnect(); abstract send