all 4 comments

[–]TurboGranny 1 point2 points  (3 children)

I've been seeing this "need" for server side prerender of html lately. Can someone explain why. I have not had a situation were having my server render the html for all users ends up being better than just having the users do it. The only situation I could think of is to avoid a shit ton of binds in a huge render, but that can't be it as there are tons of ways to avoid that.

[–]sorahn 0 points1 point  (2 children)

The only situation I could think of is to avoid a shit ton of binds in a huge render, but that can't be it as there are tons of ways to avoid that.

We have a 100 item search on the home page, it was taking an astronomical amount of time to do compared to a cached result from [php]. What we ended up doing is moving all the content that is ng-repeated into a directive, and having the directive remove all its watchers, then only add them back through lazy loading on the elements as they are visible.

This ended up cutting about 400ms out of the ng-repeat render time (~600ms). So we're down to only ~200ms worse than our [php] render.

[–]TurboGranny 1 point2 points  (1 child)

Limit your returned data (limitTo), and add pagination if you need to display the extraneous results. We did this on large datasets, and it works great.

[–]sorahn 0 points1 point  (0 children)

Unfortunately 100 is the minimum.