首页 > 解决方案 > ComponentRef.destroy() 在组件被销毁时不应用自定义动画

问题描述

我正在从我动态创建的组件中调用destroy()一个ComponentRef实例,并且我的自定义 Angular 动画没有被应用。

它们在常规组件被销毁时应用,那么为什么在您手动创建/销毁组件时不应用它们呢?有没有另一个API?

参考这个类:

/**
 * Represents an instance of a Component created via a {@link ComponentFactory}.
 *
 * `ComponentRef` provides access to the Component Instance as well other objects related to this
 * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
 * method.
 * @stable
 */
export declare abstract class ComponentRef<C> {
    // Other properties...

    /**
     * Destroys the component instance and all of the data structures associated with it.
     */
    abstract destroy(): void;
}

标签: angulartypescript

解决方案


推荐阅读