Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Problem to call setRoot in my Alert callback

$
0
0

@zhouhaowowtv wrote:

I have a login page and a home page. After I click the login, I call setRoot to my home page. This is fine.

In my Home page, there is a "Logout" button. When I click it, I'll setRoot to my Home page inside my alert's callback. Here is my code:

let confirm = Alert.create({
  title: 'Confirm',
  body: 'Are you sure to log out?',
  buttons: [
    {
      text: 'Yes',
      handler: () => {
        this.nav.setRoot(LoginPage);
      }
    },
    {
      text: 'No',
      handle: () => {
        console.log('No clicked.Do nothing!');
      }
    }
  ]
});
this.nav.present(confirm);

But screen go blank when I click "Yes". It will be fine when I click "Yes" again.

Any idea? Thanks.

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>