---
lang: en
title: 'API docs: context.asprovider'
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.asprovider.html
---

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

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [asProvider](./context.asprovider.md)

## asProvider() function

A factory function to create a template function to bind the target class as a `Provider`<!-- -->.

**Signature:**

```typescript
export declare function asProvider<T>(target: Constructor<Provider<T>>): BindingTemplate<T>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

target


</td><td>

[Constructor](./context.constructor.md)<!-- -->&lt;[Provider](./context.provider.md)<!-- -->&lt;T&gt;&gt;


</td><td>

Target provider class


</td></tr>
</tbody></table>

**Returns:**

[BindingTemplate](./context.bindingtemplate.md)<!-- -->&lt;T&gt;


