Custom Angular pipes (filters).
Import the [CovalentCommonModule] in your NgModule:
The
digits
pipe takes a number and converts the output to an appropriate numerical
measurement with an optional
precision
argument.
Converted: {{ log.digits | digits }}
With precision argument: {{ log.digits | digits: log.precision }}
Usage:
The
bytes
pipe takes a number and converts the output to an appropriate base 1024
data measurement with an optional
precision
argument.
Converted: {{ log.bytes | bytes }}
With precision argument: {{ log.bytes | bytes: log.precision }}
Usage:
The
decimalBytes
pipe takes a number and converts the output to an appropriate base 1000
data measurement with an optional
precision
argument.
Converted: {{ log.bytes | decimalBytes }}
With precision argument: {{ log.bytes | decimalBytes: log.precision }}
Usage:
The
timeAgo
pipe takes a string, number or Date timestamp (example:
2016-01-29T17:59:59.000Z
) and tranforms it to the amount of time that has gone by.
Reference: {{ log.reference }}
Usage:
The
timeUntil
pipe takes a string, number or Date timestamp (example:
{{ currentTimeStamp }}
) and tranforms it to the amount of time until that timestamp will be
reached.
Reference: {{ log.reference }}
Usage:
The
timeDifference
pipe outputs the difference between two times. Strings, Numbers or Date
timestamps are acceptable types. (example:
2016-01-29T17:59:59.000Z
).
Difference: {{ log.timestamp | timeDifference: log.timestampend }}
Difference relative to current time: {{ log.timestamp | timeDifference }}
Note: Using this pipe without arguments outputs the time difference relative to the current time.
Usage:
The
truncate
pipe limits a string to a specified
length
and adds an ellipsis.
{{ log.text_value }}
Truncate with a length value of
{{ log.truncate_length }}
: {{ log.text_value | truncate: log.truncate_length ?? 0 }}
Usage:
Note: If the last character in a returned output is a space, then that space is removed.