diff --git a/src/ng/filter/orderBy.js b/src/ng/filter/orderBy.js index 961faa368642..b8d3e302d342 100644 --- a/src/ng/filter/orderBy.js +++ b/src/ng/filter/orderBy.js @@ -123,8 +123,11 @@ function orderByFilter($parse){ var t2 = typeof v2; if (t1 == t2) { if (t1 == "string") { - v1 = v1.toLowerCase(); - v2 = v2.toLowerCase(); + v1 = v1.toLowerCase(); + v2 = v2.toLowerCase(); + if (typeof v1.localeCompare == 'function') { + return v1.localeCompare(v2); + } } if (v1 === v2) return 0; return v1 < v2 ? -1 : 1; diff --git a/test/ng/filter/orderBySpec.js b/test/ng/filter/orderBySpec.js index 5c1178910255..15a41a0f220e 100644 --- a/test/ng/filter/orderBySpec.js +++ b/test/ng/filter/orderBySpec.js @@ -23,6 +23,10 @@ describe('Filter: orderBy', function() { expect(orderBy([{a:15, b:1}, {a:2, b:1}], ['+b', '-a'])).toEqualData([{a:15, b:1}, {a:2, b:1}]); }); + it('should sort strings via localeCompare', function() { + expect(orderBy([{a:'ö'},{a:'a'},{a:'z'}], 'a')).toEqualData([{a:'a'},{a:'ö'},{a:'z'}]); + }); + it('should use function', function() { expect( orderBy(