Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Keep interpolation information in DOM so that bootstrapping from prerendered html is possible #5406

Closed
dai-shi opened this issue Dec 14, 2013 · 6 comments

Comments

@dai-shi
Copy link

dai-shi commented Dec 14, 2013

I hesitated to submit this issue, since it may be not for many people.
(and because it will be done by angular.js itself in the future. cf. #2104)

connect-prerenderer is one of my projects, which allows to prerender html pages with angular.js on server side, and even bootstrap angular.js from the prerendered pages.

One of the biggest problems is how to keep interpolation in prerendered pages.
For example, <div>{{name}}</div> will be replaced with <div>John</div>,
but <div ng-bind-template="{{name}}"/> will be replaced with <div ng-bind-template="{{name}}">John</div>, at compilation.
The latter form allows to bootstrap from it, whereas the former does not.

My hack was to patch angular.js so that it keeps interpolation information in DOM and allows boostrap from a prerendered page.
The patch for angular-1.2.5 is here

However, I don't feel like I did it in a very nice way.
It would be really nice if angualr.js includes this functionality (not this patch) and
keep interpolation information in DOM (might be as comments?)

@ghost ghost assigned vojtajina Dec 21, 2013
@FloNeu
Copy link

FloNeu commented Jan 8, 2014

+1

@pablolmiranda
Copy link

This is one block to migrate to AngularJS, the pre-render step in the server is a big thing for us. The @dai-shi patch has it value but the framework should have a option to support such thing feature.
Could the AngularJS core team bring a good solution for this?
+1

@ChristianMurphy
Copy link

+1

@donaldpipowitch
Copy link

+1

This should be compatible with an bind-once functionality (#5408). (Bind-once would be prerendered without interpolation information and normal bindings would keep interpolation information.)

In that way one could use Angular as a complete solution for templating. You could re-use angular templates as you wish.

@btford btford removed the gh: issue label Aug 20, 2014
@mhogerheijde
Copy link

+1

I know this is quite an old issue, but I am looking for this exact thing to be solved.

@Narretz
Copy link
Contributor

Narretz commented Apr 6, 2018

This is out of scope at this point of AngularJS development, as it would require considerable re-engineering. The new Angular supports server side rendering, and hydration of server side rendered templates.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants