angular-filter
angular-filter copied to clipboard
using Filter Inside a controller
Hi, How can we use this filters inside a angularjs controller. It works fine when I use it inside html with ng repeat
"data-ng-repeat="orders in orderList | unique: 'submission_Date'"
but when I try to use it inside my controller then it is not working properly
console.log($filter('unique')($scope.orderList ,$scope.orderList .submission_Date));
You will need to run a loop inside the controller too Eg:
angular.forEach($scope.orderList, function(order) {
// Your filter
})
@amer4 think this will work:
$filter('unique')($scope.orderList, 'submission_Date');