Operator
Overview
The OperatorPipe
transforms filter operators into their HTML entity representations for display in the UI. It handles various comparison operators and special cases like 'between' and 'and'.
API
transform(filter?: LegacyFilter): string
Parameter | Type | Description |
---|---|---|
filter | LegacyFilter | Optional. The filter object containing an operator and value |
Returns
string
- A string representation of the operator with the filter value.
Operator Transformations
Operator | HTML Entity | Display |
---|---|---|
lt | < | < |
lte | ≤ | ≤ |
eq | = | = |
neq | ≠ | ≠ |
gte | ≥ | ≥ |
gt | > | > |
between | Special case | > start ≤ end |
and | Special case | Uses display or value |
Usage
import { OperatorPipe } from '@sinequa/atomic-angular';
@Component({
selector: 'app-filter-display',
imports: [OperatorPipe],
template: `
<span [innerHTML]="filter | operator"></span>
`
})
export class FilterDisplayComponent {
filter = {
operator: 'gte',
value: '100'
};
// Will display as "≥ 100"
betweenFilter = {
operator: 'between',
start: '10',
end: '20'
};
// Will display as "> 10 ≤ 20"
}
Notes
The output of this pipe contains HTML entities, so it should be used with the [innerHTML]
binding in Angular templates to render properly.