Grab bag of template-binding expressions.
For use with new template-binding standards.
Convert to pretty-printed json output.
Usage:
{{data | json}}
Log to console before returning input.
Very useful for debugging.
Usage:
{{data | log}}
{{data | log('my data %s')}}
{{data | log('my data %s, %d', otherdata)}}
Slice an array of data.
Usage:
{{items | slice}}
{{items | slice(2)}}
{{items | slice(2, 5)}}
Get array of keys from an Object.
Usage:
<template repeat="{{key in items | keys}}">
{{key}}
</template>
Get array of values from an Object.
Usage:
<template repeat="{{value in items | values}}">
{{value}}
</template>
Get array of keys and values from an Object.
Usage:
<template repeat="{{item in items | keyValue}}">
{{item.key}} : {{item.value}}
</template>
Format a date using moment.js.
Usage:
{{item.date | date}}
{{item.date | date('LLL')}}
Get relative time from now.
Usage:
{{item.date | fromNow}} <!-- 2 weeks ago. -->
Get relative 'calendar' time.
Usage:
{{item.date | fromNow}} <!-- 2 weeks ago. -->
Examples and tests.
MIT