angularjs - 将 Debounce/Throttle 添加到 AngularJS ng-repeat 过滤器

标签 angularjs throttling debouncing

当我需要过滤大量对象时,如何将 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/

相关文章:

.net - 限制 Windows .NET 服务的 CPU 使用率

javascript - 如何使用 async/await 去抖动?

javascript - lodash debounce 不是 debounce 函数被调用多次而不是一次,react hooks react 原生

javascript - 构建 $http.get 请求...错误

jquery - 导航器警报功能在第二次后起作用

angularjs - 使用 Angular JS 加载图像后更新 DIV 元素

angularjs - 列出在 AngularJS 中注册的自定义指令

c# - TPL 数据流 : How to throttle an entire pipeline?

c# - 在 Visual Studio 2013 中查看受限的 WCF 调用

javascript - 当我们切换文件时忽略去抖动