I am trying to automatically save form data in Angular 4. It should work as follows:
- The user changes some data in the form → some request to save to the database is called. Suppose that within 2 seconds a timer starts here.
- Within 2 seconds from the previous save request, all changes will not cause any queries (to reduce the load on the database), but will cause another save request, then the 2-second timer will expire.
- If the timer does not start at the moment, then the save request should be called immediately.
I believe that Observable , Subject and Scheduler will help me, but I'm completely new to this. Could you suggest a better approach to achieve the above functionality?
javascript angular observable rxjs
aleksei
source share