当我需要过滤大量对象时,如何将 300 毫秒的去抖/限制添加到 ng-repeat 过滤器以提高性能。请找到下面的示例代码。
<input type="text" ng-model="q" />
<div ng-repeat="user in users | filter : q">
{{user.name}}
</div>
最佳答案
编写 ng-model-options:
<input type="text" ng-model="q" ng-model-options="{debounce: 300}"/>
关于angularjs - 将 Debounce/Throttle 添加到 AngularJS ng-repeat 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42094917/