0
这是我的代码,我不知道我在做什么错误?是否有内置的过滤器或函数来排序整数或数字的数组?如何使用自定义过滤器对angularjs中的整数数组进行排序?
<body data-ng-app="app" data-ng-controller="controller1" >
<div class="container">
<div class="row">
<input type="text" ng-model="searchbox" />
<li ng-repeat="num in numbers|filter:searchbox|orderBy:number">
{{num}}
</li>
</div>
</div>
<script type="text/javascript">
var app=angular.module('app', []).controller('controller1', ['$scope', function($scope){
$scope.numbers=[10,8,6,7];
$scope.number=function(data)
{
return data.sort();
}
}
]);
</script>
</body>
非常感谢若昂·莱亚尔:-) – shreyansh 2014-09-25 09:43:18