Using Angularjs with server side templates

Posted by codecollision on Stack Overflow See other posts from Stack Overflow or by codecollision
Published on 2012-12-19T22:07:43Z Indexed on 2012/12/19 23:03 UTC
Read the original article Hit count: 205

Filed under:
|

For SEO purposes the server renders out the full html template for a given URL on initial load. The site uses angularjs which detects the URL route and renders a client template from the JSON API.

For example, you navigate to: /blog/post-title

Server responds with post-title content. Angular loads, detects route: /blog/:post_slug and begins to load JSON and render client side template from response.

Obviously what Angular does is fine when links are followed after the initial load, but on first load it duplicates effort.

My question is if there is a clean way to prevent this situation.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about angularjs