Episodes
by Andrew Eisenberg
HTML
<body ng-app="myApp">
<div ng-controller="myCtrl">
<div ng-repeat="o in data | nonFeaturedEvent | limitTo:limit">
<span>{{o.isFeaturedEvent}}</span></br>
<span>{{o.eventName}}</span></br>
<span>{{o.eventStartDateTime}}</span></br>
<span>{{o.itemCreatedDateTime}}</span></br>
</br></br>
</div>
<button ng-click='loadMore()'>Load More</button>
</div>
</body>
JavaScript
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $window) {
// loadMore function
$scope.limit = 1;
$scope.loadMore = function () {
$scope.limit++;
}
$scope.data = [{
"IsFeaturedEvent": false,
"eventStartDateTime": "Thu, 21 March 2019, 04:30 AM",
"eventName": "Event 12",
},{
"IsFeaturedEvent": true,
"eventStartDateTime": "Thu, 21 March 2019, 04:30 AM",
"eventName": "Event 13",
},{
"IsFeaturedEvent": false,
"eventStartDateTime": "Thu, 21 March 2019, 04:30 AM",
"eventName": "Event 14",
},{
"IsFeaturedEvent": true,
"eventStartDateTime": "Thu, 21 March 2019, 04:30 AM",
"eventName": "Event 15",
},{
"IsFeaturedEvent": false,
"eventStartDateTime": "Thu, 21 March 2019, 04:30 AM",
"eventName": "Event 16",
}];
}).filter('nonFeaturedEvent', function() {
return events => events.filter(e => !e.IsFeaturedEvent);
});