Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度:无法读取属性';插入节点';在TransitionAnimationEngine中未定义的_Javascript_Angular - Fatal编程技术网

Javascript 角度:无法读取属性';插入节点';在TransitionAnimationEngine中未定义的

Javascript 角度:无法读取属性';插入节点';在TransitionAnimationEngine中未定义的,javascript,angular,Javascript,Angular,我创建了自己的指令,如果用户未登录,该指令将隐藏内容:*onlyUser。当我尝试在使用ng/动画的组件中使用它时,有时会出现错误: Cannot read property 'insertNode' of undefined at TransitionAnimationEngine 指令如下所示: export class OnlyUserDirective { constructor(private _templateRef: TemplateRef<any>,

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

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();
      }
    });
  }
}
export class OnlyUserDirective{
构造函数(私有的_templateRef:templateRef,
private _viewContainer:ViewContainerRef,
private_userContextService:userContextService){
此._userContextService.isLogged$().subscribe(x=>{
如果(x==true){
this.\u viewContainer.createEmbeddedView(this.\u templateRef);
}否则{
此._viewContainer.clear();
}
});
}
}
当我试图在带有@component({animations:[…]})的组件中使用它时,我有时会从这个问题的开头得到错误。这是预期的行为,还是一个角度错误?

这是一个已知的错误->。
我正在检查它是否在处理Angular 5

类似的问题