Page Contents
Home > @loopback/context > instantiateClass
instantiateClass() function
Create an instance of a class which constructor has arguments decorated with @inject
.
The function returns a class when all dependencies were resolved synchronously, or a Promise otherwise.
Signature:
export declare function instantiateClass<T extends object>(ctor: Constructor<T>, ctx: Context, session?: ResolutionSession, nonInjectedArgs?: any[]): ValueOrPromise<T>;
Parameters
Parameter | Type | Description |
---|---|---|
ctor | Constructor<T> | The class constructor to call. |
ctx | Context | The context containing values for @inject resolution |
session | ResolutionSession | (Optional) Optional session for binding and dependency resolution |
nonInjectedArgs | any[] | (Optional) Optional array of args for non-injected parameters |
Returns: