首页 > 解决方案 > ionic 4 侧边菜单不更新其内容

问题描述

我创建了一个 ionic 4 应用程序。

我做了什么,

- 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

问题:-

标签: ionic4side-menu

解决方案


Are the data of 'business' variable updated? If so, perhaps you could try run the assignment code inside 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
}); 

推荐阅读