You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
HMR injects duplicate angular markup into the page #665
Sorry about that. It was a mismatch between the logic needed for Angular 2.0.2 and 2.4.5+.
To fix it, edit your boot-client.ts file, and just delete the following lines:
// Before restarting the app, we create a new root element and dispose the old one
const oldRootElem = document.querySelector(rootElemTagName);
const newRootElem = document.createElement(rootElemTagName);
oldRootElem.parentNode.insertBefore(newRootElem, oldRootElem);
Leave the following one (that calls platform.destroy();) in place, as that's all that's needed on Angular 2.0.2.
This will no longer be an issue, as we've removed the option to produce projects with older versions of Angular (the Angular template now only produces 2.4.5+ projects), hence closing this.
Reacted by Steve Taylor, Mark Pieszak, Rejwanul Islam and Hayden Shelton
Would you expect this to still be a problem with Microsoft.AspNetCore.SpaTemplates 0.9.3 that was using Angular 4? I'm still seeing the issue at that point (May'ish) and am wondering if the advice above is still the recommendation for that version.
@SteveSanderson Gotcha. And that manual fix does work. I was referring to your Feb 13 note saying there should no longer be an issue. On a positive note, TrilonIO/aspnetcore-angular-universal@a83a6a9 was merged yesterday which fixes the issue.
Activity
Remove the Angular 2.0.2 template; define the 2.4.5+ template as the …
SteveSandersonMS commentedon Feb 13, 2017
Sorry about that. It was a mismatch between the logic needed for Angular 2.0.2 and 2.4.5+.
To fix it, edit your
boot-client.tsfile, and just delete the following lines:Leave the following one (that calls
platform.destroy();) in place, as that's all that's needed on Angular 2.0.2.This will no longer be an issue, as we've removed the option to produce projects with older versions of Angular (the Angular template now only produces 2.4.5+ projects), hence closing this.
kkalitowski commentedon Jul 28, 2017
Would you expect this to still be a problem with Microsoft.AspNetCore.SpaTemplates 0.9.3 that was using Angular 4? I'm still seeing the issue at that point (May'ish) and am wondering if the advice above is still the recommendation for that version.
SteveSandersonMS commentedon Aug 1, 2017
@kkalitowski Yes, nothing's changed about that yet as far as I know.
kkalitowski commentedon Aug 1, 2017
@SteveSanderson Gotcha. And that manual fix does work. I was referring to your Feb 13 note saying there should no longer be an issue. On a positive note, TrilonIO/aspnetcore-angular-universal@a83a6a9 was merged yesterday which fixes the issue.
irejwanul commentedon Feb 3, 2018
Angular 4.4.5, nothing improved yet. The solution of @SteveSanderson is working.