Skip to content

Angular 4.2.2: app component tag stacked instead of replacing the old one #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
almothafar opened this issue Jun 13, 2017 · 10 comments · Fixed by #53
Closed

Angular 4.2.2: app component tag stacked instead of replacing the old one #52

almothafar opened this issue Jun 13, 2017 · 10 comments · Fixed by #53

Comments

@almothafar
Copy link

I was trying to upgrade my Angular from 4.1.3 to 4.2.2, but got a critical issue that the component stacked instead of replacing it:

image

Downgrade solved issue, also, I tried to kill node.exe and run again the app, the issue was still occurring.

@ValentinFunk
Copy link

Having the same issue

@p3140
Copy link

p3140 commented Jun 14, 2017

+1
May be related to this one ?

@almothafar almothafar changed the title Angular 4.2.2: app component tag stacked instead of replacing the old one for Angular 4.2.2: app component tag stacked instead of replacing the old one Jun 14, 2017
@hrfarrokh
Copy link

me too

@jeandormehl
Copy link

Any news on this?

@ValentinFunk
Copy link

I have found a bit of a workaround for this by manually removing the element:

@NgModule({ ... })
class AppModule {
  constructor(public appRef: ApplicationRef) { }
  hmrOnDestroy() {
    const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
    // ...
    cmpLocation.forEach(elem => {
      (elem as any).remove();
    });
  }
}

@jeandormehl
Copy link

@kamshak This method does indeed remove the additional app components appended onto the bottom of the page but all styling and input values are also lost for modals/popups.

@atomdmac
Copy link

+1

Saw this after re-building a docker image that was previously working fine. I thought I was going crazy. Downgrading "fixed" it.

@admosity
Copy link
Contributor

Opened a PR based on what was said here, but haven't quite battle tested it. Using it now and it seems okay. @gdi2290 any idea what it might be?

@rafinskipg
Copy link

rafinskipg commented Jun 26, 2017

+1 hmr is not working for new releases of angular. And downgrading angular is not a good solution ;)

@superstarmcawesome
Copy link

I'm still seeing this in 4.4.4 and 4.4.6.

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

Successfully merging a pull request may close this issue.

9 participants