【发布时间】:2016-06-21 03:13:13
【问题描述】:
我不明白为什么在 ng-repeat 中按名称排序是不正确的。订单一开始是正确的,但随后 Holland 的订单是错误的:
<div class="row">
<div ng-if="region.checked && region.countCountries > 0" ng-repeat="region in vm.selectedRegions track by region.id" class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-left-0">
<strong class="region-title">{{ 'locales.region.' + region.name | translate }}</strong>
<div class="row">
<div ng-if="($index == 0)" ng-repeat="country in region.countries track by $index" class="col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-left-0">
<div ng-if="country.selected && ($index < region.countries.length/2)" ng-repeat="country in region.countries | orderBy: 'name' track by country.id">
<span class="fa fa-circle"></span>
<span translate="{{ 'locales.country.' + country.isoCode | translate }}"></span>
</div>
</div>
<div ng-if="($index == vm.Math.ceil(region.countries.length/2))" ng-repeat="country in region.countries track by $index" class="col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-left-0">
<div ng-if="country.selected && ($index >= region.countries.length/2)" ng-repeat="country in region.countries | orderBy: 'name' track by country.id">
<span class="fa fa-circle"></span>
<span translate="{{ 'locales.country.' + country.isoCode | translate }}"></span>
</div>
</div>
</div>
</div>
</div>
奥地利 比利时 保加利亚 丹麦 芬兰 法国 德国 希腊 匈牙利 爱尔兰 以色列 意大利 荷兰 挪威 波兰 葡萄牙 罗马尼亚 西班牙 瑞典 瑞士 火鸡 英国
【问题讨论】:
-
可能名称存储为“荷兰”,然后将
isoCode翻译为“荷兰”?
标签: angularjs ng-repeat angularjs-orderby