As covered in Register Filters/Tags, we can access filter arguments directly in filter function like:
// Usage: {{ 1 | add: 2, 3 }} |
When it comes to stateful filters, for example transform a URL path to full URL, we’ll need to access a origin in current scope:
// Usage: {{ '/index.html' | fullURL }} |
See this JSFiddle: http://jsfiddle.net/ctj364up/1/
Arrow Functions
thisin arrow functions is bound to current JavaScript context, you’ll need to usefunction(){}instead of()=>{}syntax to accessthis.contextcorrectly.