I'm using Sails.js as base for my project, and so far I'm trying to modularize every UI element using AngularJS.
Although I think this approach is good because it allows me to reuse my code as much as possible, in the end I will have to make many HTTP requests to the server because each module doesn't share data with the others.
So, what would be a solution to mitigate the number of requests and share the data among all controllers?
I have thought of 2 different solutions:
- Populate views from the back-end reducing the amount of data the AngularJS controllers are requesting.
- Request data dynamically using sockets and cache the commonly used queries.