Repository: angular
Issue: Invalid animations when moving ViewRef between ViewContainerRef
Labels: type: bug/fix,area: animations,freq2: medium,P3

<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅

Oh hi there! 😄

To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.

🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->


# 🐞 bug report

### Affected Package
<!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->
<!-- ✍️edit: --> The issue is caused by package @angular/animations


### Is this a regression?

<!-- Did this behavior use to work in the previous version? -->
<!-- ✍️--> Don't know, it affects Angular 8 and 9


### Description

<!-- ✍️-->
When you detach `ViewRef` from one `ViewContainerRef` and insert it into another `ViewContainerRef`, the animations break.

## 🔬 Minimal Reproduction
<!--
Please create and share minimal reproduction of the issue starting with this template: https://stackblitz.com/fork/angular-issue-repro2
-->
<!-- ✍️-->
https://stackblitz.com/edit/angular-eyuh3b
1. Click on "Second" button, it will show hello component with fade animation.
2. Click it again and it will disappear with fade animation - CORRECT.

Then:

1. Click on "Second" button, it will show hello component with fade animation.
2. Click on "First" button, hello component will change place to be next to the first button
3. Click on "Second" button, hello component will change place to be next to the second button again
4. Click on "Second" button again and the hello component will disappear with broke animation - INCORRECT.

You can see in console log, that the `AnimationEvent` contains animation from state "void" to "void"
<!--
If StackBlitz is not suitable for reproduction of your issue, please create a minimal GitHub repository with the reproduction of the issue.
A good way to make a minimal reproduction is to create a new app via `ng new repro-app` and add the minimum possible code to show the problem. 
Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.

Issues that don't have enough info and can't be reproduced will be closed.

You can read more about issue submission guidelines here: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-submitting-an-issue
-->

## 🔥 Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
{element: hello.ng-tns-c1-5.ng-trigger.ng-trigger-animate.ng-star-inserted.ng-animating, triggerName: "animate", fromState: "void", toState: 1, phaseName: "done", …}
element: hello.ng-tns-c1-5.ng-trigger.ng-trigger-animate.ng-star-inserted
triggerName: "animate"
fromState: "void"
toState: "void"
phaseName: "done"
totalTime: 500
disabled: false
_data: 31
__proto__: Object
</code></pre>


## 🌍  Your Environment

**Angular Version:**
<pre><code>
@angular/animations 9.0.5
@angular/common 9.0.5
@angular/compiler 9.0.5
@angular/core 9.0.5
@angular/forms 9.0.5
@angular/platform-browser 9.0.5
@angular/platform-browser-dynamic 9.0.5
@angular/router 9.0.5
core-js 3.6.4
rxjs 6.5.4
tslib 1.11.1
zone.js 0.10.2
</code></pre>

**Anything else relevant?**
<!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->

<!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->