In this article we'll talk about Debouncing and Throttling, two optimization techniques that we might want to consider whenever we're developing an Angular app that needs features such as autocomplete, real-time filtered searches, and so on: learning how to efficiently use both of them will not only improve our overall knowledge of the Angular (and RxJS) codebase, but will also ensure important performance improvements because it will greatly reduce the number of HTTP requests that our client-side code will issue to the server to retrieve data.
Introduction
Let's take the following Angular code snippet:
As we can see, this is a typical data retrieval method that will fetch a jsonData result from the server using a standard HTTP request using a local http object (most likely an instance of HttpClient instantiated in the constructor using Dependency Injection ) and store it within a local variable; such approach is tipically used by most Angular components (and services) that perform such kind of tasks.
Read the full article