-
Notifications
You must be signed in to change notification settings - Fork 482
Support rendering just a single component rather than a complete HTML document #347
Comments
I could try and take this one if it's not too difficult you think @gdi2290 ? It sounds like we just need to be testing for the existence of |
@gdi2290 We should have this as a high priority. What is involved in this change? |
@SteveSandersonMS Hey Steve, the initial html page that you are pointing to for Universal, has no I have a fix for this in the works, trying to look into it more to make sure I cover everything. I'm also wondering how we can get |
The ASP.NET templates don't point to any initial HTML page in the sense that I think you mean. We're not using the angular2-universal view engine or any equivalent. We are using angular-universal just to render-as-string individual Angular 2 components that get injected into a page being generated by ASP.NET. You can find an example of the server-side boot code we're using here: https://github.com/aspnet/NodeServices/blob/master/templates/Angular2Spa/ClientApp/boot-server.ts You'll see below the
Could the |
I'm working on this today after Jsonp support |
@gdi2290 I'm not sure if you saw my message on the Slack a while back, but to me, it looked like using |
@gdi2290 what is the status here? we currently don't have the ability to do the html component, right? |
Originally it worked when I just looked to see if there was doc type, an html tag etc (then proceed like normal), otherwise do parseFragment on the or whatever was passed in and it did seem to work. @jeffwhelpley think the codes still there, just commented out. |
OK, so in that case, this issue is dependent on #533 which is a top priority right now. Let's focus on that and then we can come back to this. |
Sounds good to me, yea there's definitely a lot of high priority stuff right now. |
It looks to me like this is now fixed. At least, there's no longer any error when prerendering just a template containing Could you confirm whether this is now officially supported? It's not going to break anything subtle in angular-universal if people start just passing |
Hey @SteveSandersonMS we updated to parse5 2.* a while back, which now returns a ASTNode.Document, so that might be why it isn't erroring out anymore. The problem is now the page will have 2 I just tested it out, and it does work, but we still want to be using Also, I tried adding in my original logic on our side, and it worked in running parseFragment (since in your case I'll create a PR #614 about it so we can get this one ironed out.
|
this will still be an issue without replacing all of the platform services being created in core such as Meta Service (in PR angular/angular#12322), Title Service (already in), ignore Base element, ResourceLoader, and replace Style Host to not use an element. Angular core wants to be agnostic to the platform which means everything should live within the app element tag. The problem is that is not that case as there are platform services that are needed to change values outside of that element. Platform services are slowly being built out now that final is released. |
might be supported in ng4 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
As discussed, please add support for rendering just a single component element to an HTML string, instead of requiring the template to be an entire HTML document.
For example, instead of this:
... it should be possible to do this:
Currently, Angular Universal automatically wraps the output in
<html>
etc even if it wasn't requested in the template. This feature is particuarly relevent when including Angular 2 server-side rendered content in an existing server-rendered page, e.g., on ASP.NET.The text was updated successfully, but these errors were encountered: