1

enter image description hereI am relatively new to using AngularJs and I am having trouble understanding/ getting orderBy to work. I am familiar that by using it with an ng-repeat on an array you can sort the array... however when I try and implement it while using the track by $index.. I know that filtering has to come before tracking but I still cant get it to work. On a side note... I have an Object of Objects which I thought still might work by determining the keys in the objects.

html

<table id="data-sources-table" class="table drag-drop header-fixed">
        <tbody ng-repeat="(field, profile) in currentSample.dsProfile | orderBy:'[display-name]' track by $index">
            <tr ng-style="$index % 2 === 0 && {'background-color': '#ffffff'} ||
                          $index % 2 === 1 && {'background-color': '#f9f9f9'}">
                <td>
                    <span class="btn-property"
                          uib-tooltip="{{field}}"
                          tooltip-placement="right">
                        <b>{{profile["display-name"]}}</b>
user2402107
  • 913
  • 5
  • 22
  • 43

0 Answers0