angularjs – 如何使orderby过滤器工作数组的字符串?

前端之家收集整理的这篇文章主要介绍了angularjs – 如何使orderby过滤器工作数组的字符串?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这里是不工作的代码:Demo: http://jsfiddle.net/8dt94/63/ @H_301_1@<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']; });
您可以通过方法排序,以便可以使用toString方法 @H_301_1@<ul ng-repeat="strVal in arrVal | orderBy:'toString()' | filter:searchText">

猜你在找的Angularjs相关文章