Skip to content

Inject Container within itself. #70

@basedalexander

Description

@basedalexander

Container should be available for injections into members it contains (service locator anti pattern). Auto register container within itself when instantiating.

  • Write tests first, every member of a container should be able to inject container they're inside of. class B { constructor(@Inject(TContainer) private container: IContainer) {} }

  • create container type TContainer = Symbol('IContainer')` next to IContainer in the same file.

  • when instantiating a new container, that container instance should register itself within itself via TContainer type ( this.register({ token: TContainer, useValue: this })

  • Create an example file for typescript and javascript.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions