Skip to content

Upgraded element children not destroyed/cleaned #26208

@jbedard

Description

@jbedard

I'm submitting a...

[X] Bug report  

Current behavior

UpgradeComponent.ngOnDestroy (actually UpgradeHelper.onDestroy) invokes $element.triggerHandler('$destroy') on the upgraded element itself but does not a) cleanup data + event bindings and b) do anything on child elements

Expected behavior

Destroying an upgraded AngularJS component should do the same as destroying in AngularJS. All data + events should be cleaned up and the $destroy DOM event should be triggered, on the element itself and all descendants.

Minimal reproduction of the problem with instructions

https://angular-gitter-nrsm9m.stackblitz.io/ (the red square should be cleaned up along with the upgraded component)

What is the motivation / use case for changing the behavior?

Putting an AngularJS component in Angular should perform proper cleanup, not leak memory.

Environment

Angular version: 6.1.7, but has probably existed forever

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions