Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module("app", []).
- filter('department', function(filterFilter) {
- return function(items, args) {
- var productMatches;
- var output = [];
- var count = 0;
- if (args.selectedDepartment.Id !== undefined && args.option) {
- for (let i = 0; i < items.length; i++) {
- productMatches = items[i].products.filter(function(el) {
- return el.Order__r.Department__r.Id === args.selectedDepartment.Id;
- });
- if (productMatches.length !== 0) {
- output[count] = {};
- output[count].products = productMatches;
- output[count].firstProduct = items[i].firstProduct;
- count++;
- }
- }
- }
- return output;
- };
- }).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement