Skip to main content

Inject

@webda/core • Readme | API


Function: Inject()

Inject(parameterOrName?, defaultValue?, optional?): (target, propertyName) => void

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)

Parameters​

• parameterOrName?: string

of the service to inject

Might consider to split into two annotations

• defaultValue?: string | boolean

• optional?: boolean

Returns​

Function

Parameters​

• target: any

• propertyName: string

Returns​

void

Source​

packages/core/src/services/service.ts:96