When working with my angular controller, I am trying to filter and assign certain objects with a value of true
. I attempted to iterate using angular.forEach
, but instead of getting the truthy object, I am receiving all objects as the result.
Below is the code snippet:
$scope.splash.$promise.then(function (result) {
$scope.allApps = result; //50 apps.
// splashAppsHandler();
$scope.splashApps = angular.forEach( $scope.allApps, function (app) {
return app.projects.project.splash === true; //only 5 apps
});
console.log($scope.splashApps); //getting all 50 apps!?
});
Could someone please advise on the correct approach to achieve this?