Jeremy Thomas
Jeremy Thomas

Reputation: 6684

Ionic 2: NavPop brings me to root rather than previous page

I am having an issue with navigation in my app. The page hierarchy works like so:


Top

Root


A standard flow of events would be:

  1. Start at the HelloIonicPage
  2. push() the ClientGenericPage
  3. Select the tab corresponding to the CheckInPage
  4. push() the VisitComponent from a button on the CheckInPage

The issue arises when I attempt to pop() from the VisitComponent. I would expect to end up at the CheckInPage but instead I end up at the HelloIonicPage (root component).

When I call this.navCtrl.getViews() I see an array of 2 views: [CheckInPage, VisitComponent].

I am really at a loss as to why I would end up at the root after calling this.navCtrl.pop().

Upvotes: 1

Views: 41

Answers (1)

Jeremy Thomas
Jeremy Thomas

Reputation: 6684

As it turns out, the ClientGenericPage header was displayed on top of the VisitComponent header, and thus clicking back was firing the event on the parent, not the child.

Upvotes: 1

Related Questions