【问题标题】:Ionic - Need Modal page before HomePage LoadIonic - 在主页加载之前需要模态页面
【发布时间】:2018-03-05 13:46:12
【问题描述】:

我正在使用 Ionic 3,并且需要我的应用程序在执行开始时选择哪家公司将工作。 我创建了一个模式页面(selCompany)来选择公司并将其存储在本地存储中。这个页面工作正常,但是当我完成选择时,主页已经加载,没有选择页面的数据(它在完成选择之前已经加载)。

app.component.ts

let selCompany = this.modalCtrl.create(SelCompany);
selCompany.present();

以同样的方式,我将创建一个登录页面。

选择后如何加载主页?

Tks

【问题讨论】:

  • 你能在这里添加更多代码吗?
  • 你需要哪部分代码?

标签: typescript ionic-framework ionic2 ionic3 modalviewcontroller


【解决方案1】:

将您要启动的页面导入为app.component.ts 文件中的默认/起始页面。

import { YourPageHere } from '../pages/yourpagefolder/yourpagefile';

导入后将根页面更改为您要首先加载的页面。

export class MyApp {
    //This is where you need to give the name of the page.
    rootPage:any = YourPageHere;

    constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
        platform.ready().then(() => {
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            statusBar.styleDefault();
            splashScreen.hide();
        });
    }
}

您现在应该加载模态,并且您可以在完成选择后加载其他页面。希望对你有帮助。

【讨论】:

  • 工作正常!完成 SelectPage 后,我推送了 HomePage。非常感谢,解决了我的问题
  • 乐于助人:)
猜你喜欢
  • 2017-05-25
  • 2015-04-02
  • 2016-09-18
  • 2014-07-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多