ionic4 - 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
问题:-
- 当我点击标记时,我的侧边菜单不会更新它的内容
- 当我在标签之间切换时它会更新,我认为刷新标签时
解决方案
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
});
推荐阅读
- c++ - reinterpret_cast with an integer literal is not a constexpr
- json - 手动触发获取请求会给出不同的响应,然后通过整个应用程序进行
- java - 当 Windows 资源管理器找到它时,Chrome 不会为 json 文件找到一个长的本地文件路径
- javascript - 提交成功后jquery清除表单
- oauth-2.0 - 为什么使用 jhipster oauth2 有状态,以及如何实现?
- spring-boot - 在 Wildfly 中部署的 Spring Boot 应用程序“无法实例化 WebApplicationInitializer 类”
- c# - unity c# 使用 .text 后隐藏文本
- android - Ionic 4 - 如何在 Web 浏览器中打开 URL 而不是 Android App 上的应用程序中的 webview?
- javascript - 将发布请求发送到在 ngrok 上运行的应用程序时出现 502 错误
- ruby-on-rails - Rails 验证不是文本字段的数字错误