Welcome Guest, Not a member yet? Register   Sign In
best way to create nested arrays from mySQL
#3
Smile 

Thanks mwhitney!

Basically take each case on its merits and don't be tempted by premature optimisation Dodgy

The factors I guess will be whether we are returning a small part of a large dataset (e.g. orders for a specific customer) or a significant quantity of the data (e.g. all customers and their lifetime value) and whether the user is likely to visit all of the data. (for example, If I am displaying a list of products and the user is only going to choose 1 then there is little point in passing the complete dataset for all products to the angular $scope until I know which one has been chosen)

One other option (and one of the reasons I like angular) would be late fetch and bind of the data. If the customer list is paginated, Then you could return an entire list of customers to angular but only return the order list for the previous, current and next pages. This way the volume of data passed via the initial http request and the subsequent ajax requests is limited and effectively pre-fetched which give the appearance of speed, even if the data in the background is slower than normal.

I guest the most important thing is to ensure that the interface between the angular $scope model and the api json response is consistent; how that is built is the whole point of separation of concerns in the MVC world.
Reply


Messages In This Thread
RE: best way to create nested arrays from mySQL - by obiron - 03-05-2015, 12:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB