Service for formatting data types used within tokens of error messages using IDataTypeFormatter instances.

interface IDataTypeFormatterService {
    lazyLoad: ((service) => void);
    serviceName: string;
    services: IServices;
    format(value, lookupKey?): DataTypeResolution<string>;
    find(lookupKey, cultureId): null | IDataTypeFormatter;
    register(item): void;
    getAll(): IDataTypeFormatter[];
    dispose(): void;
}

Hierarchy (view full)

Implemented by

Properties

lazyLoad: ((service) => void)

Sets up a function to lazy load the configuration when any of the other functions are called. This function can be set after some initial registration. It will be discarded immediately after its used.

Type declaration

serviceName: string
services: IServices

Provides access to services.

Methods

  • Converts the native value to a string that can be shown to the user. Result includes the successfully converted value or validation error information.

    Formatting uses localization. It uses IDataTypeFormatter classes, which may handle multiple cultures. When searching for a formatter, it tries the ValidationServices.activeCultureID first and if no formatter is supplied for that culture, it has a chain of fallback cultures that you supply in the constructor.

    Parameters

    • value: any
    • Optional lookupKey: null | string

      If not supplied, a lookup key is created based on the native value type. If you need alternative formatting or are supporting a user defined type, always pass in the associated lookup key. They can be found in the LookupKeys module.

    Returns DataTypeResolution<string>

    successfully converted value or validation error information.

  • If the user needs to abandon this instance, they should use this to clean up active resources (like timers) and to release memory that would stall the garbage collector from disposing this object. It should assign any object reference to undefined as a strong indicator that the object has been disposed.

    Returns void

Generated using TypeDoc v0.25.12