this.loading = true;
this.subscription = this.orderService.approveOrder(this.orderDraft.orderId)
.subscribe((result: any) => {
if (result) {
this.router.navigate([`/${ODRootMenu}s/`])
this.successDialog(Message.TITLE_INIT_ORDER_APPROVAL_SUCCESSFULLY, Message.BODY_ORDER_APPROVAL_SUCCESSFULLY(this.orderDraft.orderId));
this.loading = false;
}
}, (error: any) => { console.log(error); });
在this.router.navigate([/${ODRootMenu}s/
])之后,如何等待新路由器的所有服务加载并显示successDialog,加载指示器?
答案 0 :(得分:0)
this.router.navigate
是一个承诺,如果导航完成,它将返回true。您可以像这样使用它作为示例:
this.router.navigate([`/${ODRootMenu}s/`]).then(() =>
{
this.successDialog(Message.TITLE_INIT_ORDER_APPROVAL_SUCCESSFULLY,
Message.BODY_ORDER_APPROVAL_SUCCESSFULLY(this.orderDraft.orderId));
this.loading = false;
})