---
lang: en
title: 'API docs: context.invokemethod'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.invokemethod.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [invokeMethod](./context.invokemethod.md)

## invokeMethod() function

Invoke a method using dependency injection. Interceptors are invoked as part of the invocation.

<b>Signature:</b>

```typescript
export declare function invokeMethod(target: object, method: string, ctx: Context, nonInjectedArgs?: InvocationArgs, options?: InvocationOptions): ValueOrPromise<InvocationResult>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  target | object | Target of the method, it will be the class for a static method, and instance or class prototype for a prototype method |
|  method | string | Name of the method |
|  ctx | [Context](./context.context.md) | Context object |
|  nonInjectedArgs | [InvocationArgs](./context.invocationargs.md) | <i>(Optional)</i> Optional array of args for non-injected parameters |
|  options | [InvocationOptions](./context.invocationoptions.md) | <i>(Optional)</i> Options for the invocation |

<b>Returns:</b>

[ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;[InvocationResult](./context.invocationresult.md)<!-- -->&gt;


