AngularJS: orderBy - 字符串和数组不一样

AngularJS: orderBy - string & array are not the same

我有一组用户:

$scope.users = [
  {name: 'Anh', age: 10},
  {name: 'Ánh', age: 10},
  {name: 'Ba' , age: 10}
]

当我使用 orderBy:'name' 时,结果是:

  1. Ánh

但是当我使用多个字段时 orderBy:['name','age'] 结果不同:

  1. Ánh

等待您的帮助!

试试这个..

var app = angular.module('filterSample', []);
app.controller('filterCtrl', function ($scope) {

  $scope.data = {
    messages: ['first', 'second', '3rd', 'fourth', 'fifth']
  }

  $scope.startsWith = function (actual, expected) {
    var lowerStr = (actual + "").toLowerCase();
    return lowerStr.indexOf(expected.toLowerCase()) === 0;
  }
});

和html作为

<ul border="1px" ng-repeat="msg in data.messages | filter:search:startsWith">
      <li>{{msg}}</li>
    </ul>

或检查这个 plunkr-http://plnkr.co/edit/gcVYfZXTqsDU1Z7REU2I?p=preview