2017-02-07 5 views
2

거대한 수의 배열을 필터링해야하므로 성능을 향상시키기 위해 ng-repeat 필터에 300ms의 Debounce/Throttle을 추가 할 수 있습니까? 아래 샘플 코드를 찾으십시오.AngularJS ng-repeat 필터에 Debounce/Throttle 추가

<input type="text" ng-model="q" /> 
<div ng-repeat="user in users | filter : q"> 
{{user.name}} 
</div> 
+1

http://stackoverflow.com/questions/15304562/how-to-put-a-delay-on-angularjs-instant-search – TheSameSon

+0

@TheSameSon이 –

+0

hadiJz에 댓글을 달았습니다.이 주석 앞에 답을 적었습니다. 그래서 당신은 나를 아무 목적없이 downvoted –

답변

4

쓰기 NG-모델 옵션 :

<input type="text" ng-model="q" ng-model-options="{debounce: 300}"/> 
+0

^1. 나는 새로운 요점을 배웁니다. 감사 –