Skip to main content
Version: 0.4.0

Binding a service

Services can be easily bound to the container calling it directly.

import { Container } from '@cuaklabs/iocuak';

class Dummy {}

const container: Container = Container.build();
container.bind(Dummy);

Services can also be bound through a ContainerModule:

import { ContainerModule, ContainerModuleBindingService } from '@cuaklabs/iocuak';

const container: Container = Container.build();

const containerModule: ContainerModule = {
load: (containerModuleBindingService: ContainerModuleBindingService): void => {
containerModuleBindingService.bind(Dummy);
},
};

container.load(containerModule);