Home Angular JS batching many small requests
Reply: 0

Angular JS batching many small requests

user1035
1#
user1035 Published in May 23, 2018, 8:14 pm

I am building a habit tracking application in AngularJS where users can input which habits they performed during the week. The interface is a table that looks like :

 
+--------+-------+-------+-------+-------+-------+
| Habit  | Date1 | Date2 | Date3 | Date4 | Date5 |
+--------+-------+-------+-------+-------+-------+
| Habit1 | Y/N   | Y/N   | Y/N   | Y/N   | Y/N   |
| Habit2 | Y/N   | Y/N   | Y/N   | Y/N   | Y/N   |
| Habit3 | Y/N   | Y/N   | Y/N   | Y/N   | Y/N   |
| Habit4 | Y/N   | Y/N   | Y/N   | Y/N   | Y/N   |
| Habit5 | Y/N   | Y/N   | Y/N   | Y/N   | Y/N   |
+--------+-------+-------+-------+-------+-------+

where each table cell (Y/N) can be toggled on or off. Each time one of these cells is clicked I am performing an API request to update the db. This results in many small requests being sent each session.

My question is - How would you batch all of these requests into a single request? What is the best approach for dealing with such a situation in AngularJs?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.334575 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO