---
lang: en
title: 'API docs: context.binding.tag'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.binding.tag.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; [tag](./context.binding.tag.md)

## Binding.tag() method

Tag the binding with names or name/value objects. A tag has a name and an optional value. If not supplied, the tag name is used as the value.

<b>Signature:</b>

```typescript
tag(...tags: BindingTag[]): this;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  tags | <code>BindingTag[]</code> | A list of names or name/value objects. Each parameter can be in one of the following forms: - string: A tag name without value - string\[\]: An array of tag names - TagMap: A map of tag name/value pairs |

<b>Returns:</b>

`this`

## Example


```ts
// Add a named tag `controller`
binding.tag('controller');

// Add two named tags: `controller` and `rest`
binding.tag('controller', 'rest');

// Add two tags
// - `controller` (name = 'controller')
// `{name: 'my-controller'}` (name = 'name', value = 'my-controller')
binding.tag('controller', {name: 'my-controller'});


```


