[Vuejs]-Vuejs template not updating applying filter to property

0👍

What you’re doing is absolutely backwards.

You actually want to loop the original array but apply a filter on it.

<template v-for="card in cards | filterBy onlyMatching">

Then, in your code, create a custom filter:

Vue.filter('onlyMatching', function (cards) {
    return infoBlocs.filter(function(item) {
        return item.Data.event_type.match('something_test');
    });
})

This should totally work. Now, whenever the array is changed in any way, the filter will get triggered and the list will be re-rendered.

0👍

Come to find out the filtering was working all along. There’s an issue with the conditional templating. I’ll ask that in another question.

Leave a comment