Skip to main content

Inject

@webda/core


Variable: Inject

const Inject: {(initialValue, context): void; (...args): (initialValue, context) => void; }

Defined in: packages/core/src/services/service.ts:108

Inject a Bean inside this attribute

If defaultValue is undefined and parameter is not starting with params:, it will resolve by calling this.getService(parameterOrName)

If defaultValue is defined or parameterOrName starts with params: then first argument is consider a parameter and it will resolve by calling this.getService(this.getParameters()[parameterOrName] || defaultValue)

Call Signature​

(initialValue, context): void

Parameters​

initialValue​

undefined

context​

ClassFieldDecoratorContext

Returns​

void

Call Signature​

(...args): (initialValue, context) => void

Parameters​

args​

...[string, string | boolean, boolean]

Returns​

(initialValue, context) => void

Param​

parameterOrName

of the service to inject

Might consider to split into two annotations TODO @webda/compiler could get all interfaces and ancestors classes to find the correct service