Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Duplicate <html> tag in markup for angular #251

Closed
andreymir opened this issue Aug 9, 2016 · 4 comments
Closed

Duplicate <html> tag in markup for angular #251

andreymir opened this issue Aug 9, 2016 · 4 comments

Comments

@andreymir
Copy link

For angular template, with server-side rendering enabled the resulting markup is invalid. It contains duplicate <html> and <body> tags.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Home Page - TestAngular</title>
        <base href="/" />
        <link rel="stylesheet" href="/dist/vendor.css" />
        <link rel="stylesheet" href="/dist/styles.css" />
    </head>
    <body>
<app><!DOCTYPE html><html><head><title></title></head><body><app><h1>My First Angular 2 App</h1></app></body></html></app>
<script src="/dist/vendor.js?v=ST5Wa4e5mzPX7ta66f3OtVqEjo2qferfDltnP-noHNg"></script>
<script src="/dist/main.js?v=xXJhvd8rq7SFv-t1CDTZ0d9PUS2-IRftQ4NTA_R9aqc"></script>
</body>
</html>
@ronnyek
Copy link

ronnyek commented Aug 10, 2016

I believe this is actually a known thing related to a angular-universal bug angular/universal#347

@andreymir
Copy link
Author

While it is not supported by angular could we update boot-server.ts and remove incorrect tags from the result like this:

    return bootloader.serializeApplication(config).then(html => {
        return { html: html
                .replace('<!DOCTYPE html><html><head><title></title></head><body><app>', '')
                 .replace('</app></body></html>', '') };
    });

?

@SteveSandersonMS
Copy link
Member

@andreymir Absolutely - that's a good workaround for now.

We don't want to put that in the templates because it looks confusing and we're hoping the angular/universal#347 issues will get fixed soon anyway. But for your own use in your own project, your workaround looks ideal.

@MarkPieszak
Copy link
Contributor

I still owe you a fix for 347 in Universal, apologies been swamped lately! @SteveSandersonMS

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

No branches or pull requests

4 participants