Skip to content

Ability to get 'injector' class from 'injected' one. #2

@benoitlahoz

Description

@benoitlahoz

We should implement a decorator, which name could be @Injector or @Parent to be used by injected class (e.g. to get global metadata).

@Assemblage({
  inject: [
    [InjectedService]
  ]
})
class App {
  public globalMetadata = { foo: 'bar' };

  constructor(public injected: InjectedService) {}
}

@Assemblage()
export class InjectedService {
  constructor(@Parent() private parent: any) {
    console.log(parent.globalMetadata); // { foo: 'bar' }
  }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions