Value Decorator

Module
import { Value } from "@tsed/common"
Source/packages/common/src/config/decorators/value.ts

Overview

function Value(expression: any, defaultValue?: any): (target: any, propertyKey: string) =>; void;

Description

Return value from ServerSettingsService.

Example

import {Env} from "@tsed/core";
import {Constant, Value} from "@tsed/common";

export class MyClass {

   @Constant("env")
   env: Env;

   @Value("swagger.path")
   swaggerPath: string;

   @Value("swagger.path", "defaultValue")
   swaggerPath: string;

   constructor() {
      console.log(this.swaggerPath) // undefined. Not available on constructor
   }

   $onInit() {
     console.log(this.swaggerPath)  // something
   }
}