Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you proposed is a viable approach with AngularJS. Another solution would be to run the javascript code on the server side, and then send the output to the browser (Similar to Airbnb's <a href="https://github.com/airbnb/rendr" rel="nofollow noreferrer">Rendr</a>). However, nothing like this exists that I know of for AngularJS. It might not be possible because of the way the scopes are handled.</p> <p>With the bootstrapped javascript object approach, it's simple and you avoid visiting the server twice.</p> <p>So, </p> <ol> <li>Construct your app as a SPA client that consumes a REST API.</li> <li>Using server-side templating, render an extra javascript object with the data you want to bootstrap and include it on the page (or another js file).</li> <li>On the front-end, transfer the data from this bootstrapped javascript object into your $resource model.</li> </ol> <p>See this similar question with AngularJS and Rails.<br> <a href="https://stackoverflow.com/questions/12451864/how-to-bootstrap-data-as-it-it-were-fetched-by-a-resource-service-in-angular-js">How to bootstrap data as it it were fetched by a $resource service in Angular.js</a></p> <p>For SEO, use this <a href="http://www.yearofmoo.com/2012/11/angularjs-and-seo.html" rel="nofollow noreferrer">AngularJS SEO guide</a> [1]. This guide was mentioned by AngularJS engineers at Google I/O [2].</p> <p>[1] <a href="http://www.yearofmoo.com/2012/11/angularjs-and-seo.html" rel="nofollow noreferrer">http://www.yearofmoo.com/2012/11/angularjs-and-seo.html</a><br> [2] <a href="http://www.youtube.com/watch?feature=player_detailpage&amp;v=HCR7i5F5L8c#t=2238" rel="nofollow noreferrer">http://www.youtube.com/watch?feature=player_detailpage&amp;v=HCR7i5F5L8c#t=2238</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload