0

I am trying to sort the shop titles in alphabetical order right now the data is showing randomly. I am adding the fiddle of that: https://jsfiddle.net/jtdk157s/

enter code here

1 Answer 1

1

User the filter OrderBy and specify the property of the Object:

ng-repeat="item in groupedData | filter:categoryFilter | orderBy:['node.location','node.title']

Check working sample: https://jsfiddle.net/bLvLy1sh/1/

With groupBy filter

<div ng-repeat="(key, items) in groupedData | groupBy: 'node.location' )">
    <h2>{{key}}</h2>
    <ul>
        <li ng-repeat="location in items">
            {{ location}}
        </li>
    </ul>
</div>
Sign up to request clarification or add additional context in comments.

9 Comments

No its not working if you check with the previous results the output is changed and it is not showing in correct way.
and what should be the corect way? I can see that the list is sorted by title alphabetically
But it is not sorting according to the location I mean to say for example &pizza is a terminal C shop but it is showing in separate. So, I need those shops as to filter according to the existing functionality but they need to be in alphabetical order.
You did it correctly but still there is some sort of error is coming if you see the National hall last shop in the list it is showing Boar's Head Delicatessen which is a Terminal A shop and in Terminal A list the Bracket Room CAVA Mezze Grill Green Beans Coffee Grille District. these are terminal B shops. Some how it is not taking correctly. Can you please check it
Maybe there is something wrong with the ng-if check this updated version: jsfiddle.net/bLvLy1sh/2
|

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.