如何在使用 Ionic 2 显示警报时停止执行

How to stop execution while showing alert with Ionic 2

我正在使用

显示警报
    import {Alert, NavController} from 'ionic/ionic';
    .............
    var alert = Alert.create({ .....
    .....
    });
    nav.present(alert)
    console.log('fooo'); //This gets executed before 'ok' is clicked or the alert is closed

它出现了,但下一行的执行并没有像一般警报那样停止。任何解决方法?

我不知道你用什么来提醒。但是警报我使用了杠杆承诺。我的意思是,当您单击警报中的 "ok" 按钮时,相应的承诺将得到解决。所以我会说将下一行的代码移动到您之前在承诺中设置的回调中。

我想更准确一点,但你只提供了一行代码,没有任何其他提示;-)

希望对您有所帮助。 蒂埃里