【发布时间】:2017-02-22 08:28:18
【问题描述】:
我在我的页面中使用 ng2-toastr 并且工作正常,但是当我在页面中有嵌套组件时,现有的 ng2-toastr(ToastManager) 范围被破坏并且 toastr 不工作。
constructor(public toastr: ToastsManager,public vcr: ViewContainerRef) {
this.toastr.setRootViewContainerRef(vcr);
}
在我调用时的方法中
this.toastr.warning('Its Warning','Alert');
它工作正常,但在我加载其他组件时在我的 html 中,即
<es-app></es-app>
我页面中的 toastr 不工作(没有错误)
有时我会得到:
尝试使用已破坏视图:detectChanges 错误:尝试使用已破坏视图:DetectChanges at ViewDestroyedError
【问题讨论】:
标签: angular toastr angular-toastr