How to configure global Aurelia DI container?

The documentation says (Dependency injection (DI) | The Aurelia 2 Docs)

Services are usually resolved automatically via constructor injection. However, you can also resolve them manually:

const profileService: ProfileService = container.get(ProfileService);

But where does container get from? It looks like that

const container = DI.createContainer()

creates a new container. How to get an instance from the Aurelia container before application starts?

const container = DI.createContainer()
const numberValueConverter = container.get(NumberValueConverter)


You don’t do this in the configuration step of main.ts anymore, but in the constructor of myApp like:

export class MyApp {
        numberValueConverter: NumberValueConverter
    ) {

Hi @mreiche, note that there is no global container, as it is for Au1. There is certainly a root container associated with an Aurelia app instance, but that’s about it.

Also noted that you are setting the locale in a value converter directly. Is there any reason, you aren’t injecting the i18n directly into your value converter to get current locale?