fix(cdk/overlay): animations interrupted on repeat insertions (#24815)
fix(cdk/overlay): animations interrupted on repeat insertions (#24815)

When an overlay is detached, we remove it from the change detection tree and the DOM, but we don't destroy it completely so that it can be re-attached. Re-attachment is the same process, but in reverse: we re-add the element to the DOM and the change detection tree. The problem is that we were attaching the element to the change detection tree before re-inserting it into the DOM which caused the Angular animations package not to animate the element since it's not in the DOM yet.

These changes resolve the issue by attaching the element to the DOM first.

Fixes #24749.
crisbeto/material2,angular/components,crisbeto/material2,angular/components,angular/components,angular/components,crisbeto/material2,crisbeto/material2