In Vue JS, call a filter from a method inside the vue instance
this.$options.filters.capitalize(this.word);
See http://vuejs.org/api/#vm-options
This is what worked for me
-
Defining filter
//credit to @Bill Criswell for this filter Vue.filter('truncate', function (text, stop, clamp) { return text.slice(0, stop) + (stop < text.length ? clamp || '...' : '') });
-
Using filter
import Vue from 'vue' let text = Vue.filter('truncate')(sometextToTruncate, 18);