下面是不起作用的代码: Demo:http://jsfiddle.net/8dt94/63/
<div ng-controller="MyCtrl">
<input type="text" ng-model="searchText" />
<ul ng-repeat="strVal in arrVal|orderBy|filter:searchText" >
<li>{{strVal}}</li>
</ul>
</div>
var app=angular.module('myApp', []);
app.controller('MyCtrl', function ($scope,$filter) {
$scope.arrVal = ['one','two','three','four','five','six'];
});
发布于 2013-04-07 12:04:30
您可以按方法排序,因此可以使用toString方法
<ul ng-repeat="strVal in arrVal | orderBy:'toString()' | filter:searchText">
发布于 2013-01-24 12:02:50
编写一个custom filter
app.filter('mySort', function() {
return function(input) {
return input.sort();
}
});
HTML:
<ul ng-repeat="strVal in arrVal|filter:searchText|mySort">
https://stackoverflow.com/questions/14493116
复制相似问题