API
@agape/metadata

Label Decorator

Specifies a label for the decorated class, property, method, or parameter.

API

@Label(  label: undefined | string,  plural?: string)

Label

Specifies a label for the decorated class, property, method, or parameter.

@paramlabel:  undefined | string
@paramplural:  string

Description

Specifies a label for the decorated class, property, method, or parameter.

Labels can be used when displaying in user interfaces such as form inputs, tables, and auto-generated documentation.

This decorator sets the label and labelPlural properties on the associated MetadataDescriptor.

Usage

Class

@Label('Product', 'Products')
class Product {
  name: string;
  price: number;
}

Property

class Product {
  @Label('SKU')
  skuCode: string;
}

Method

class ProductService {
  @Label('Create Product')
  create(): void {
    // ...
  }
}

Parameter

class ProductService {
  create(@Label('Product') product: Product): void {
    // ...
  }
}