Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 角度JS中的Order by_Angularjs_Angularjs Orderby - Fatal编程技术网

Angularjs 角度JS中的Order by

Angularjs 角度JS中的Order by,angularjs,angularjs-orderby,Angularjs,Angularjs Orderby,我想在下面的卡片上订购 <div ng-app="myApp" ng-controller="Ctrl"> <div ng-repeat="card in myCards | orderBy:'card'"> <businesscard>{{card}}</businesscard> </div> </div> angular.module('myApp', []) .controller('

我想在下面的卡片上订购

<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'];
});

{{card}
angular.module('myApp',[])
.controller('Ctrl',函数($scope){
$scope.myCards=['J','S','A'];
});
我期待的结果是, A. J

相反,我得到了 J s
A

要按值排序,只需不向排序依据提供任何参数即可(请参阅):


要按值排序,只需不向排序依据提供任何参数即可(请参阅):


试试这个

<div ng-repeat="card in myCards | orderBy:'toString()'">
   <businesscard>{{card}}</businesscard>
</div>

{{card}
试试这个

<div ng-repeat="card in myCards | orderBy:'toString()'">
   <businesscard>{{card}}</businesscard>
</div>

{{card}

但是它是一个数组,你可以按字母顺序排列,但是我如何在html中使用angular js使用order by Clause删除
'card'
中的单引号据我所见,你的链接是按名字排序的?你的小提琴包含一个对象数组,而你的问题包含一个值数组。。。它们的行为方式不同,但它是一个数组,你可以按字母顺序排列,但我如何使用html中的angular js,使用order by Clause删除
'card'
中的单引号,你的链接是按名字排序的?你的小提琴包含一个对象数组,而你的问题包含一个值数组。。。它们的行为方式不同