Questions tagged [aurelia-di]

Aurelia has a built in dependency injection framework that is used for managing objects.

Useful links

7 questions
5
votes
1 answer

Get access to Aurelia's Dependency Injection system without constructor injection

Is there a way to get access to Aurelia's Dependency Injection system without constructor injection. I have a class called Box. I need to know when one of its properties change so I can update my validation. I found that I can use…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
4
votes
1 answer

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

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…
3
votes
3 answers

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

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…
mark
  • 1,953
  • 1
  • 24
  • 47
2
votes
1 answer

How do I inject objects from the DI container in Aurelia-dialog

Using Aurelia, you can put stuff in the container and then inject it. The container state is not shared in the dialog. Is there a way to get the data I injected in the container, and use it inside the dialog? Code example home.js fetchString(){ …
Randy
  • 9,419
  • 5
  • 39
  • 56
2
votes
2 answers

Aurelia inject mock dependency

I have this aurelia component for displaying a feed to the user which depends on a custom API service class called Api for fetching the feed. The Api class has a get() function which in turn uses HttpClient to fetch the data. Trying to test the…
0
votes
1 answer

Accessing another model-view from a page inside the main router

I’m trying to find out a way to creating a custom view-model and making its functions accessible from a page within the main router-view element. This custom view-model, in my case called "secondbar" is supposed to be located under main nav-bar and…
George P.
  • 181
  • 1
  • 8
0
votes
1 answer

What pattern is used to provide global configuration of custom elements or attributes in aurelia?

I know that one can export configure function and also register components as global resource. But what pattern do you use when your component provides "default" configuration that can be overridden? This needs to happen during configuration phase…
epitka
  • 17,275
  • 20
  • 88
  • 141