我有一个包含国家列表的模型
$scope.model = { name: "foo",countriesVisited: ["CA","AR","GB","FR","MX","AU","IE","RU","IT","ES","IN","US","NL","DE","CL","BR","JP","NZ","PL"] }
使用ng-repeat指令按照显示的顺序列出它们.
设置orderBy过滤器会对商品进行排序,但订单看似随机.见这plunker
取下过滤器并观察输出偏移.将其粘贴回来,这是一个奇怪的顺序.
有没有办法让countriesVisited数组在不将其移动到自己的$scope变量的情况下进行排序?
<li ng-repeat="country in model.countriesVisited | orderBy:'toString()'">