Skip to content

leave-animation not triggered when injecting ViewContainerRef into component #48667

Closed

Description

@zetti-caletti

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

animations

Is this a regression?

No

Description

leave-animation not triggered when injecting ViewContainerRef into component. When commenting out the injection in the constructor, the leave-animation works as expected.

Tested it in Angular 15.04 and Angular 9.1.13. Both don't work.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-f8qyay

Please provide the exception or error you saw

No exceptions or errors.

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

Angular CLI: 15.0.4
Node: 16.16.0
Package Manager: npm 8.11.0
OS: linux x64

Angular: 15.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.4
@angular-devkit/build-angular   15.0.4
@angular-devkit/core            15.0.4
@angular-devkit/schematics      15.0.4
@angular/cdk                    14.2.7
@angular/material               14.2.7
@angular/pwa                    0.5.3
@schematics/angular             15.0.4
rxjs                            7.4.0
typescript                      4.8.4

Anything else?

No response

Activity

  1. JeanMeche commented on Jan 9, 2023

    @JeanMeche
    Member

    There was already an attemp to fix something like that in #28162

    I've got another repro case.

    From what I get, this is because isHostElement is false here :

    if (isHostElement) {
    const hostNS = this.namespacesByHostElement.get(element);
    if (hostNS && hostNS.id !== namespaceId) {
    hostNS.removeNode(element, context);
    }
    }

    the false being set here (the LNode is a Lcontainer):

    if (lNodeToHandle != null) {
    let lContainer: LContainer|undefined;
    let isComponent = false;
    // We are expecting an RNode, but in the case of a component or LContainer the `RNode` is
    // wrapped in an array which needs to be unwrapped. We need to know if it is a component and if
    // it has LContainer so that we can process all of those cases appropriately.
    if (isLContainer(lNodeToHandle)) {
    lContainer = lNodeToHandle;
    } else if (isLView(lNodeToHandle)) {
    isComponent = true;
    ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView');
    lNodeToHandle = lNodeToHandle[HOST]!;
    }

  2. added
    area: animations
    on Jan 11, 2023
  3. added this to the needsTriage milestone on Jan 11, 2023
  4. added a commit that references this issue on May 25, 2023
    df65c4f
  5. angular-automatic-lock-bot commented on Jun 25, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Jun 25, 2023
  7. added a commit that references this issue on Jan 23, 2024
    eae9027
  8. added a commit that references this issue on Jun 6, 2024
    bada919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: animations

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions