Skip to content

DOM elements are not removed when the root view is removed if the RendererFactory2 is injected into the root provider #45108

@arturovt

Description

@arturovt

Which @angular/* package(s) are the source of the bug?

animations

Is this a regression?

Yes

Description

All DOM elements remain when calling NgModuleRef.destroy(), but actually, all ngOnDestroy hooks are invoked, event listeners are removed, basically, all cleanups are done except removing nodes from DOM.

⚠️ This happens only when the BrowserAnimationsModule is imported and the RendererFactory2 is inejcted, this doesn't happen with BrowserModule.

Please provide a link to a minimal reproduction of the bug

https://github.com/arturovt/ngmoduleref-destroy-issue

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 13.2.3
Node: 14.17.0
Package Manager: yarn 1.22.17
OS: linux x64

Angular: 13.2.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.3
@angular-devkit/build-angular   13.2.3
@angular-devkit/core            13.2.3
@angular-devkit/schematics      13.2.3
@angular/cli                    13.2.3
@schematics/angular             13.2.3
rxjs                            7.5.4
typescript                      4.5.5

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions