Is it most effective to combine Angularjs with an HTTP Client on the backend, such as Zend_Http_Client or Guzzle, to have the server retrieve the data and then send it as json to javascript during rendering?
I am aware that Angularjs is primarily designed for Single Page applications, which is why it is logical for it to lazy load the data.
However, if we want to adopt an approach where we still dynamically render the page but delegate the task of organizing the content to Angularjs, which framework would be suitable for managing the AngularJS views? Currently, project templates like angular-seed are all static.
The concept is to have the server deliver a page with the embedded json object, with Angular taking charge on the client side to fetch additional content as required.
Instead of just a single contact page (e.g: index.html), there would be multiple pages like profiles.html, products.html. Utilizing the backend can be useful, especially for sections that rarely change, like the username displayed in the top right corner of the page. Personally, I believe it is beneficial to have this data preloaded on the page rather than requesting it from the server after the page has loaded.
As observed by bigblind, this appears to be the approach taken by popular sites like Facebook, Gmail, and Twitter. They embed the data on page load and then load additional content via services afterwards.
The concept can be illustrated as follows:
Webservice <---------- Backend------------> Frontend
<------------------------------------------
The backend hands off the task of querying the webservice to provide initial data in the rendered page to the client. Subsequently, the client can directly communicate with the webservice to retrieve additional content.
Given the above setup, what would be the optimal development stack to use?