@loopback/docs
Version:
Documentation for LoopBack 4
36 lines (23 loc) • 1.02 kB
Markdown
lang: en
title: 'API docs: metadata.decoratorfactory.withtarget'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/metadata
permalink: /doc/en/lb4/apidocs.metadata.decoratorfactory.withtarget.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/metadata](./metadata.md) > [DecoratorFactory](./metadata.decoratorfactory.md) > [withTarget](./metadata.decoratorfactory.withtarget.md)
## DecoratorFactory.withTarget() method
Set a reference to the target class or prototype for a given spec if it's an object
<b>Signature:</b>
```typescript
withTarget(spec: T, target: Object): T;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| spec | <code>T</code> | Metadata spec |
| target | <code>Object</code> | Target of the decoration. It is a class or the prototype of a class. |
<b>Returns:</b>
`T`