Open Nickproger opened 7 years ago
I haven't tried the md-delay option but looking at the documentation it seems it may work for you.
https://material.angularjs.org/latest/api/directive/mdAutocomplete
md-delay: "Specifies the amount of time (in milliseconds) to wait before looking for results"
Could you please close the issue as question answered :-) if this works for you?
@henrymana,
Unfortunately it doesn't help.. as i understand it just postpone calling handler for getting matched items.
In my opinion it would be good for performnce if md-autocomplete
didn't fire any $digests at all until md-delay
fires handler.
It seems md-autocomplete
should be rewritten in more 'vanilla-js' (not-angular) way or use ng-model-options
with debounce
inside. And if so then after this PR https://github.com/angular/angular.js/pull/16064 will be merged this issue could be fix automatically...
(without this PR will have 1 $digest per key instead of 3)
Actual Behavior:
What is the issue? *
Video: https://www.screencast.com/t/as67DajHFV<md-autocomplete/>
causes too many $digest cycles on each key press. In our complex app with big amount of watchers, it causes text-cursor freezing (and app at all).What is the expected behavior?
Is it possible to reduce to 1 $digest or/and apply ng-model-options debounce functionality in some way? https://docs.angularjs.org/api/ng/directive/ngModelOptionsCodePen (or steps to reproduce the issue): https://codepen.io/anon/pen/yXVwRa?editors=1010
CodePen Demo which shows your issue:
https://codepen.io/anon/pen/yXVwRa?editors=1010Details:
Open browser console to see the result and type the text into<md-autocomplete/>
.AngularJS Versions: *
AngularJS Version:
1.6.4AngularJS Material Version:
1.1.4Additional Information:
Browser Type: *
Browser Version: *
OS: *
Stack Traces:
Shortcut to create a new CodePen Demo. Note:
*
indicates required information. Without this information, your issue may be auto-closed.