2017-08-09 59 views
3

我創建了自己的指令,如果用戶未登錄,則隱藏內容:* onlyUser。當我嘗試在利用納克/動畫組件使用它我有時會得到一個錯誤:Angular:無法在TransitionAnimationEngine處讀取未定義的屬性'insertNode'

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(); 
     } 
    }); 
    } 
} 

,當我嘗試用@組件中使用它組件({動畫:[...]})我有時會從這個問題的開始處得到錯誤。這是預期的行爲還是角度錯誤?

+0

類似的問題在這裏 – Marek

回答

相關問題