@loopback/docs
Version:
Documentation for LoopBack 4
37 lines (24 loc) • 1.11 kB
Markdown
lang: en
title: 'API docs: context.invokemethod'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.invokemethod.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [invokeMethod](./context.invokemethod.md)
## invokeMethod() function
Invoke an instance method with dependency injection
<b>Signature:</b>
```typescript
export declare function invokeMethod(target: Object, method: string, ctx: Context, nonInjectedArgs?: any[]): ValueOrPromise<BoundValue>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| target | <code>Object</code> | Target of the method, it will be the class for a static method, and instance or class prototype for a prototype method |
| method | <code>string</code> | Name of the method |
| ctx | <code>Context</code> | Context |
| nonInjectedArgs | <code>any[]</code> | Optional array of args for non-injected parameters |
<b>Returns:</b>
`ValueOrPromise<BoundValue>`