我想在卡片下面订购
<div ng-app="myApp" ng-controller="Ctrl">
<div ng-repeat="card in myCards | orderBy:'card'">
<businesscard>{{card}}</businesscard>
</div>
</div>
angular.module('myApp', [])
.controller('Ctrl', function($scope) {
$scope.myCards = ['J', 'S', 'A'];
});
我期待的结果是, 一个 Ĵ 小号
相反,我得到了 Ĵ 小号 甲答案 0 :(得分:3)
要按值排序,只需向orderBy
提供参数(参见orderBy array item value in Angular ng-repeat):
<div ng-repeat="card in myCards | orderBy">
答案 1 :(得分:0)
试试这个
<div ng-repeat="card in myCards | orderBy:'toString()'">
<businesscard>{{card}}</businesscard>
</div>