Skip to content

Latest commit

 

History

History
137 lines (91 loc) · 2.37 KB

03.builtin-filters.md

File metadata and controls

137 lines (91 loc) · 2.37 KB

03. Built-in Filters

Filters are used as modifier of value, that is passed into attribute directive. Could be useful e.g. for checking, if result list is empty or text equals specific value.

and

since 0.0.1

Stands for "and". Returns boolean.

<span ajsf-hide="hide | and userAllows">Hidden, user allows that</span>
else

since 0.0.1

If result is not true, then it returns value.

<span ajsf-text="!true | else 'No way'">Displays 'No way'</span>
eq

since 0.0.1

Stands for "equals". Returns boolean.

<span ajsf-hide="list.length | eq 0">No data to be displayed</span>
filter

since 0.0.1

Filters array for values as object or string.

<div ajsf-repeat="list | filter filterObject"></div>
gt

since 0.0.1

Stands for "greater than". Returns boolean.

<span ajsf-hide="list.length | gt 0">No data to be displayed</span>
gte

since 0.0.1

Stands for "greater than or equals". Returns boolean.

<span ajsf-hide="value | gte 0">Value is positive</span>
limit

since 0.0.1

Limits result, usefull for limiting result list.

<div ajsf-repeat="data | limit limitValue">
	<span ajsf-bind="item"></span>
</div>
lt

since 0.0.1

Stands for "lower than". Returns boolean.

<span ajsf-show="list.length | lt 1">No data to be displayed</span>
lte

since 0.0.1

Stands for "lower than or equals". Returns boolean.

<span ajsf-show="value | lt -1">Value is negative</span>
ne

since 0.0.1

Stands for "not equals". Returns boolean.

<span ajsf-show="value | ne 'staticValue'">Value is not expected</span>
or

since 0.0.1

Stands for "or". Returns boolean.

<span ajsf-hide="hide | or userAllowsHide">Hidden, or user allows to hide that</span>
prefix

since 0.0.1

Sets prefix to defined value

<span ajsf-hide="data | prefix 'Speed: '"></span>
suffix

since 0.0.1

Sets suffix to defined value

<span ajsf-hide="data | suffix ' per second'"></span>
then

since 0.0.1

If result is true, then it returns value.

<span ajsf-text="true | then 'Yeah!'">Displays 'Yeah!'</span>

Previous chapter: 02. Built-in Attribute Directives

Next chapter: 04. Custom Attribute Directives