Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FilterConfig

Represents settings which can be used to configure FiltersService behavior (e.g. via filter annotation).

Let's define several terms for better understanding.

     //Instance of this class is registered in filtersService via call of "registerFilterTarget" method below.
     //We call such declarations "target type".
     class EndUserClass {
        //this property has @filter annotation. We call such properties "target property"
        @filter
        public parameter1 = 'Hey';
        //this property doesn't. So, it's not "target property"
        public parameter2 = 'There';
     }
     let endUserClassInstance = new EndUserClass();
     let filterService = new FilterService();

     // This means that filtersService will operate on this specific instance since it was registered with registerFilterTarget.
     // We call such objects instances "target object".
     filterService.registerFilterTarget(endUserClassInstance);

Hierarchy

  • FilterConfig

Index

Properties

Optional coerce

coerce: boolean

Specifies that FiltersService must coerce values when serializing or parsing data.

For example, 'null' string will be converted to null, 'true' string will be converted to boolean true, '1.0' string will be converted to 1.0 number etc. To achieve this functionality FiltersService uses coerceValue function.

note

If you use filter annotation this parameter will be true by default.

Optional defaultValue

defaultValue: any

Default value that will be used to reset target property value via FiltersService.resetValues method call.

If this option wasn't specified, FiltersService uses the value of target property which was assigned to it at the moment of first call of FiltersService.resetValues, FiltersService.applyParams or FiltersService.getRequestState.

Optional emptyIsNull

emptyIsNull: boolean

Specifies that any falsy value (e.g. empty string) must be converted to null by FiltersService.getRequestState method.

Optional ignoreOnAutoMap

ignoreOnAutoMap: boolean

When this property is set to true, FiltersService.applyParams method skips value parsing and doesn't apply anything to target property.

Commonly this property is useful if you have some custom logic of building 'target property' value and you want to apply it by yourself.

Optional omitIfNullOrUndefined

omitIfNullOrUndefined: boolean

Specifies that property will be omitted by FiltersService.getRequestState method if it has null or undefined value.

Optional parameterName

parameterName: string

Name of parameter which will be used to build request object with FiltersService.getRequestState

note

If you use filter annotation and this property wasn't specified then it will be equal to propertyName

Optional propertyName

propertyName: string

Name of target property in target type which will be used by FiltersService to read and write values.

You don't need to specify this property when using filter annotation since filter sets it automatically.

Methods

Optional parseFormatter

  • parseFormatter(rawValue: any, allValues?: object): any

Optional serializeFormatter

  • serializeFormatter(value: any): any

Generated using TypeDoc