1

I'm trying to do a group by for a select element with angular js,starting from this json file:

 [ { city:'Casacanditella', region: 'Abruzzo' ,
id: 19,name: 'museo prova' },
{ city'Archi', region: 'Abruzzo',
id: 20,name: 'Museo aperto' }]

What I want is to have the element displayed in this way

  • Region
    • City
      • Name

so grouped by region and then by city. How can i do it ? I've tried to do something like this

ng-options="m.museumName group by (m.region and m.city ) for m in museum"

It's obviously wrong,but in practice is what I expect to see. Thanks in advance for the help!

0

1 Answer 1

1

Hmmm. Im not sure if it is possible to do group by on select tag by twice. But I made string manipulation on grouping by.

ng-options="museum.name group by museum.region + ' ' + museum.city for museum in museums"></select>

Here is a plnkr

Sign up to request clarification or add additional context in comments.

1 Comment

I've tried in this way too,is a way out but not what I'm looking for but, as you said, maybe it's not possible and I'm looking for Pandora :). Thanks .

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.