ionic 4侧面菜单不会更新其内容

时间:2019-11-11 13:25:48

标签: ionic4 side-menu

我创建了ionic 4应用程序。

  • 我正在使用本地Google地图和自定义标记。
  • 当我单击一个标记时,我想打开带有位置详细信息的侧面菜单。

我做了什么

- I have disabled the menu at first on app.component.ts
- When ionViewWillEnter() on Map Tab, I have disabled the side-menu
- When ionViewWillLeave() on Map Tab, I have disabled the side-menu
- Side-menu only will enable when to click on the place marker
- I have triggered the event when clicking on place marker
- This event carries the data of place
- I have used the variable 'business' to fill the side-menu
- I have subscribed the event on app.component.ts and assign the 
place data to 'business' variable

问题:-

  • 单击标记时,我的侧边菜单不会更新其内容
  • 当我在标签之间切换时,它会更新,我认为是在刷新标签时

1 个答案:

答案 0 :(得分:1)

“业务”变量的数据是否已更新? 如果是这样,也许您可​​以尝试在ngzone中运行分配代码。

// import zone in your app.component.ts
import { NgZone } from '@angular/core';
// add zone provider to the component constructor
  constructor(private zone: NgZone) {
   // ...
  }

// cath click event, then
this.zone.run(() => { 
// update data here
});