JSFiddle - React, Tailwind, and code Playground

by GruffBunny

HTML

<div ng-app='MyModule' ng-controller='MyController'>
    <h1>Unfiltered list</h1>
    <ul>
        <li ng-repeat="feed in feeds">{{feed.name}}</li>
    </ul>
    <h1>Filtered list - feeds on or before {{cutOffDate | date}}</h1>
    <ul>
        <li ng-repeat="feed in feeds | filter:customFilter(cutOffDate)">{{feed.name}}</li>
    </ul>
</div>

JavaScript

angular.module('MyModule', [])

.controller( 'MyController', function($scope){
    
    $scope.feeds = [
        { name: 'March', publishedDate: new Date( 2014, 2, 1 ) },
        { name: 'April', publishedDate: new Date( 2014, 3, 1 ) },
        { name: 'May', publishedDate: new Date( 2014, 4, 1 ) }
    ];
    
    $scope.cutOffDate = new Date(2014,3,1);
    
    $scope.customFilter = function(cutOffDate){
        return function(feed){
            return feed.publishedDate <= cutOffDate;
        };        
    };
});