0

I have an array I want to use groupby angular's filter and to group it by an array of criterias. Is there any way to do this? I guess I might use revision but I don't know how.

For example I have array of football teams. Each team have color, number of players, name, city, country. I have array of data filters -country, city, players and color and I want to use groupby in the order of this array

1 Answer 1

0

not sure about angular. but just include underscore (it's more known for array/object manipulation) into your project then:

say you had an array of objects like an array of these:

car = {
    make: "nissan",
    model: "sunny",
    color: "red"
};

then you'd just go:

var redCars = _.groupBy(cars, 'color');
Sign up to request clarification or add additional context in comments.

3 Comments

But if I have an array of groupby values I want to use? This is my problem. Let's say I want to groupby color and then by brand and then by year
not sure what you mean, show an example of your array in your original question
you might want to look at multiple group by with underscore then. stackoverflow.com/questions/10022156/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.