Posted by & filed under AngularJS, LoopbackJS.

While the team does not provide explicit directions for getting their service/NodeJS service to work with Loopback, it isn’t hard to do so. At the top of your top level bootstrap JS file, after the “app” variable is declared simply provide the following:

app.use(require('prerender-node').set('prerenderToken', '<your token here>'));

Then, from the service dashboard, add a URL to your site manually (this URL needs to be world-accessible) and see if it caches the content correctly. Within my AngularJS controller I needed to provide “window.prerenderReady = false;” and “window.prerenderReady = true;” to indicate when all content was loaded, but this quirk may be particular to my setup.

You can also test the prerendering simply by appending “?_escaped_fragment_=” to the end of a URL. It may look different from your live site, but all text content should display.