ionic 4 侧边菜单不更新它的内容
ionic 4 side menu doesn't update it's content
我创建了一个 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
问题:-
- 当我点击标记时,我的侧边菜单没有更新它的内容
- 当我在标签之间切换时更新,我想刷新标签时
'business'变量的数据更新了吗?
如果是这样,也许你可以尝试 运行 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
});
我创建了一个 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
问题:-
- 当我点击标记时,我的侧边菜单没有更新它的内容
- 当我在标签之间切换时更新,我想刷新标签时
'business'变量的数据更新了吗? 如果是这样,也许你可以尝试 运行 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
});