I have a standard ng-repeat
<tr ng-repeat="tran in filteredTransactions(history)">
$scope.history is doing a call to a factory to get a json result back
$scope.history = historyFactory.getHistory;
I have created another scope object to compare items from an array and filter the $scope.history to build the ng-repeat
$scope.filteredTransactions = function () {
if ($scope.filterBy.length > 1) {
return $scope.history.filter(function (tran) {
return $scope.filterBy.indexOf(tran.slot) !== -1;
});
}
else {
return $scope.history;
}
}
I have a list of 'buttons' that users will be able to click to engage that item in the filter. For instance if they click 'Item 1' I would like that to be added to the array and the ng-repeat filtered accordingly.
I have an ng-click function that is pushing/popping the items out of the array correctly. However the ng-repeat isn't updating. Is there a better way to get this to work?