Default Angular Template creates duplicate html and body tags
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
I'm not sure why this is still a problem even though it was supposedly fixed: https://github.com/angular/universal/issues/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>', '')
});
@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.
@Anyone found a solution to this problem?