gpt4 book ai didi

javascript - Angular:无法在 TransitionAnimationEngine 读取未定义的属性 'insertNode'

转载 作者:太空狗 更新时间:2023-10-29 18:01:31 24 4
gpt4 key购买 nike

我创建了自己的指令,如果用户未登录则隐藏内容:*onlyUser。当我尝试在使用 ng/animation 的组件中使用它时,有时会出现错误:

Cannot read property 'insertNode' of undefined at TransitionAnimationEngine

指令看起来像这样:

export class OnlyUserDirective {
constructor(private _templateRef: TemplateRef<any>,
private _viewContainer: ViewContainerRef,
private _userContextService: UserContextService) {
this._userContextService.isLogged$().subscribe(x => {
if (x === true) {
this._viewContainer.createEmbeddedView(this._templateRef);
} else {
this._viewContainer.clear();
}
});
}
}

当我尝试在带有 @Component({ animations: [...] }) 的组件中使用它时,我有时会从这个问题的开头得到错误。这是预期的行为,还是 Angular 错误?

最佳答案

这是一个已知错误 -> https://github.com/angular/angular/issues/19712 .我正在检查它是否适用于 Angular 5

关于javascript - Angular:无法在 TransitionAnimationEngine 读取未定义的属性 'insertNode',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45589180/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com