angular ui-select 未在下拉列表中加载大列表
angular ui-select not loading big list in dropdown
这是我的 json 世界城市文件:google drive link。
这是我的 html 代码:
<div class="form-group">
<label class="control-label">
CITY
</label>
<ui-select name="city" ng-model="myModel.city" theme="selectize" >
<ui-select-match placeholder="{{ 'placeholders.project.city' | translate }}">
{{$select.selected}}
</ui-select-match>
<ui-select-choices repeat="r in selectedcity | filter: $select.search">
<div ng-bind-html="r | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
为什么有些国家的列表没有加载? json 文件有问题吗?还是因为一些国家有很多城市?是因为超过了ui-select的限制吗?
有些国家加载了列表,有些则没有,它是空的。
您必须将视图限制为较小的数字才能获得良好的性能,例如 | limitTo: 10
:
<ui-select-choices repeat="r in selectedcity | filter: $select.search | limitTo: 10">
这是我的 json 世界城市文件:google drive link。
这是我的 html 代码:
<div class="form-group">
<label class="control-label">
CITY
</label>
<ui-select name="city" ng-model="myModel.city" theme="selectize" >
<ui-select-match placeholder="{{ 'placeholders.project.city' | translate }}">
{{$select.selected}}
</ui-select-match>
<ui-select-choices repeat="r in selectedcity | filter: $select.search">
<div ng-bind-html="r | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
为什么有些国家的列表没有加载? json 文件有问题吗?还是因为一些国家有很多城市?是因为超过了ui-select的限制吗? 有些国家加载了列表,有些则没有,它是空的。
您必须将视图限制为较小的数字才能获得良好的性能,例如 | limitTo: 10
:
<ui-select-choices repeat="r in selectedcity | filter: $select.search | limitTo: 10">