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.

Default Angular Template creates duplicate html and body tags #1233

Description

Create a new ASP.NET Core 2.0 Web App with the default Angular template. Build and run. View the source. Note the html, head, and body tags located within the tag. The console also enumerates the errors. This is obviously unintended, and I assume is an artifact of the pre-renderer.

Activity

  1. dmlsrc commented on Aug 28, 2017

    @dmlsrc

    I'm not sure why this is still a problem even though it was supposedly fixed:
    angular/universal#347

    I ended up putting the following in boot.server.ts for now:

                        resolve({
                            html: state.renderToString()
                                .replace('<html><head>', '')
                                .replace('</head><body>', '')
                                .replace(/<\s*app.*?>/,'')
                                .replace('</app></body></html>', '')
                        });
  2. SteveSandersonMS commented on Sep 6, 2017

    @SteveSandersonMS
    Member

    @ltctech They only fixed it temporarily, then brought back the issue in a later version unfortunately.

    @MarkPieszak has been working with the Angular team on hopefully improving the APIs around server-side rendering so we can get the distinct outputs (HTML, title, styles, etc.) separately instead of them all being mashed together in a big HTML document string. If Angular does implement that then we'll certainly make use of it, but failing that @ltctech's workaround is as good as it gets.

  3. pravin271 commented on Dec 12, 2017

    @pravin271

    @anyone found a solution to this problem?

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