Page Contents

Home > @loopback/context > Binding > toClass

Binding.toClass() method

Bind the key to an instance of the given class.

Signature:

toClass(ctor: Constructor<T>): this;

Parameters

Parameter Type Description
ctor Constructor<T> The class constructor to call. Any constructor arguments must be annotated with @inject so that we can resolve them from the context.

Returns:

this