Skip to content

createChildContainer · Core API

function createChildContainer(parent, providers?): Container;

Creates a child container that can resolve providers from its parent.

Child containers may register their own providers while still reusing parent providers. Scoped providers create one cached instance per resolving child.

Parameter Type Default value Description

parent

Container

undefined

Container used as the fallback provider registry.

providers

readonly Provider[]

[]

Providers registered locally in the child.

Container

A new child container.

DuplicateProviderError When the child providers contain the same token more than once.