JSFiddle - React, Tailwind, and code Playground

by Trisox

HTML

<div ng-app="myApp">
    <ul ng-controller="TestCtrl">
        <li ng-repeat="task in tasks | selectedTags:tags">{{ task }}</li>
    </ul>
</div>

JavaScript

angular.module('myApp', [])
.filter('selectedTags', function() {
    return function(tasks, tags) {
        return tasks.filter(function(task) {

            for (var i in task.Tags) {
                if (tags.indexOf(task.Tags[i]) != -1) {
                    return true;
                }
            }
            return false;

        });
    };
})
.controller('TestCtrl', function($scope) {
    $scope.tags = ['Like'];
    $scope.tasks = [
        { Title: "This is a task title",
          Tags: ["Test","Tag","One","Two","Three"] },
        { Title: "Another test tag title",
          Tags: ["Some", "More", "Tags"] },
        { Title: "One more, why not",
          Tags: ["I","Like","Dirt"] },
        { Title: "Last one!",
          Tags: ["You","Like","Dirt"] }
    ];
});