【发布时间】:2019-04-29 04:22:21
【问题描述】:
我正在尝试将 Angular 下拉菜单 (Angular 4+) 与 10000+ 条记录绑定,它正在挂起应用程序,我们无法执行任何其他操作。
我只是用*ngFor,同样的
<select class="form-control browser-default col-md-12" name="attributeName" [(ngModel)]="attributeName">
<option *ngFor="let item of typeArray" [ngValue]="item">
{{item}}
</option>
</select>
我也尝试了像 ng2-auto-complete 和 ng2-completer 这样的解决方案,但是当我开始输入时,应用程序挂起,因为数据量很大。 还有其他可行的解决方案吗?
【问题讨论】:
-
在您的
ngFor上使用trackBy,并尝试从材料中查看虚拟卷轴。否则通过使用自动完成在服务器端修复它,但使用服务器查询数据 -
@PierreDuc 不幸的是,我们现在不能从服务器端做任何事情。我需要一种机制,通过它我只能从客户端模仿无限滚动。
-
ng-select是我们在下拉列表中加载 26000 个数据的最佳方式 - 甚至不需要第二次检查 [ng-select.github.io/ng-select#/templates -
@RahulSwamynathan 我正在尝试.. 你能告诉我如何将字符串数组绑定到选择中吗?
标签: angular performance autocomplete dropdownbox