Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 停止加载页面_Ionic Framework_Ionic2 - Fatal编程技术网

Ionic framework 停止加载页面

Ionic framework 停止加载页面,ionic-framework,ionic2,Ionic Framework,Ionic2,我使用的是Ionic 2,并希望通过类似于PHP die()的feather加载终止页面;作用 下面是我目前正在使用的方法 fetch_data() { let loader = this.loadingCtrl.create({ content: 'Loading...' }); loader.present(); this.bank.types().subscribe( response => { this.linkBankTypes = respo

我使用的是Ionic 2,并希望通过类似于PHP die()的feather加载终止页面;作用

下面是我目前正在使用的方法

fetch_data() {
    let loader = this.loadingCtrl.create({ content: 'Loading...' });
    loader.present();
    this.bank.types().subscribe( response => {
      this.linkBankTypes = response.results;
      loader.dismiss();
    }, err => {
        loader.dismiss();
        loader = this.loadingCtrl.create({ content: 'No Internet connection. Make sure Wi-Fi or cellular data is turned on, then try again.' });
        //Kill the page from here
    });
  }
PHP的die()函数停止页面的创建,并允许PHP运行环境向客户端浏览器返回严重错误消息

您可以通过抛出异常来导致Ionic崩溃,但这不是一种令人愉快的用户体验,因此不推荐这样做

相反,您可以导航到错误页面或显示指示错误的消息


NavController
push
pop
可用于导航到错误页或返回到上一页

你是说nav.pop?在
loader.disease()
之后,是否需要再次显示加载?在我看来,一条简单的警报信息就足够了。另外,你认为“杀死页面”会发生什么。这里有几个选项-导航到任何其他页面/导航到主页/只需退出应用程序/转到internet设置?