【发布时间】:2020-09-09 09:56:07
【问题描述】:
我做了一个带有标题的 http 帖子。在这篇文章之后,我导航到客户列表并希望显示包含条目的成功消息。如何在其他路线上显示消息? 这是我的代码:
postData({
let url = "api.url"
var header = new HttpHeaders .... // etc.
this.http.post(url, { company: this.form.value.company }, { headers (header)}).toPromise().then((data: any) => { console.group(data) })
在发布路由到页面显示消息后:
this.router.navigate(['customer']);
this.showMsg = true;
这是我的html
<div *ngIf="showMsg">Success</div>
但没有显示成功消息。为什么?我该怎么办?非常感谢您的帮助!
【问题讨论】: