UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

35 lines (22 loc) 1.02 kB
--- lang: en title: 'API docs: context.binding.bind' 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.binding.bind.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Binding](./context.binding.md) &gt; [bind](./context.binding.bind.md) ## Binding.bind() method A static method to create a binding so that we can do `Binding.bind('foo').to('bar');` as `new Binding('foo').to('bar')` is not easy to read. <b>Signature:</b> ```typescript static bind<V = unknown>(key: BindingAddress<V>): Binding<V>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | key | [BindingAddress](./context.bindingaddress.md)<!-- -->&lt;V&gt; | Binding key | <b>Returns:</b> [Binding](./context.binding.md)<!-- -->&lt;V&gt;