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

Duplicate <html> tag in markup for angular #251

Description

@andreymir

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>

Activity

  1. ronnyek commented on Aug 10, 2016

    @ronnyek

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

  2. andreymir commented on Aug 10, 2016

    @andreymir
    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>', '') };
        });

    ?

  3. SteveSandersonMS commented on Aug 15, 2016

    @SteveSandersonMS
    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.

  4. MarkPieszak commented on Aug 15, 2016

    @MarkPieszak
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions