1


My angular application is lagging on <input> fields and specially on <textarea> ones. I used chrome dev tools to inspected what was happening and I found out the whole component tree is being refreshed on every character I type.

I started with template driven forms, moved to reactive forms, tried changing to "OnPush" change detection, runOutsideAngular (this one I'm not sure I took the best approach because I created the formGroup inside it), nothing seems to work.

Is there any way I can stop these changes when the focus is on input fields?

Thanks.

Manish Balodia
  • 1,863
  • 2
  • 23
  • 37
  • After reading numerous articles about angular performance and change detection I found [this one](https://blog.angularindepth.com/how-i-increased-the-performance-of-an-extremely-deeply-nested-angular-reactive-form-by-380-c1b18ea668db) from @SiddAjmera that also [answered a related question here on StackOverflow](https://stackoverflow.com/questions/54532104/angular-7-reactive-form-slow-response-when-has-large-data#answer-54568730).
    My particular issues was with method calls inside interpolations "{{...}}" on the template.
    – MumiaIrrequieta Apr 11 '19 at 11:55

1 Answers1

0

It sounds like you have a much deeper problem at hand. If angular is chugging that much on a value change you probably have some sort of design flaw. I would strip out the logic in your component and start from a bare bones form. You can then work in a few changes at a time to see which one's are causing the lag.

If you post some code I can check it out and update my answer.

Sorry if this isn't a great answer, but I don't have high enough rep to just post this in a comment.

Afermann
  • 116
  • 1
  • 3
  • I understand what you're saying, but I would like to focus more on the change detection being triggered on every key stroke on an input/textarea field. I know what tasks are being triggered that are delaying the input, I just don't see a reason why they should be triggered and would like to stop it. – MumiaIrrequieta Apr 11 '19 at 09:22