Ionic using popTo specifc page

I need popTo specific page.

I tried to this

this.navCtrl.popToRoot('CartPage');

But i am getting this err.

Cannot create property 'direction' on string 'CartPage'.

How can i fix this issue.

Kindly advice me,

Thanks.

Because popToRoot expects an options object, not a component. If you want to just reset the root use setRoot() instead.

Thanks for ur reply.I used setRoot().It’s work fine.But Now My current page is CartPage

Again I click the nav back button goto ShippingPage.Once again i click the nav back button goto CartPage.

So navigation between only two pages.

Actually, i developed Ecommerce app.

If the user orders the products Need to authenticated.So going to SigninPage.after user sign in to ShippingPage.

I need If user authenticated nav.pop using does not goto SigninPage

I don’t know how popToRoot should help you achieving that, but if you pass in a object with the correct properties (animation direction for instance: whether it’s back or forward) you could do that.

From what I understand, you want this flow:

cart --> shipping --> if auth, then wrap up order
or
cart --> shipping --> if !auth, then go to sign in. If sign in, go back to shipping.

Wouldn’t it be nice to not actually leave your current nav stack in the shipping, but just do the auth within a modal like this?

cart --> shipping --> !auth, open up sign in modal. Sign in --> close modal and continue where you were

But i need dont need modal .Sign in in also a Onesection like Page.

Then on shipping you check whether if someone’s authenticated. If a user is, wrap up the order. If he isn’t, push the signInPage. If someone’s signed in, pop back to ShippingPage.

So: sign in page. If signed in: this.navCtrl.popTo(‘CartPage’)

I also tried popTo But it doesnot work why?

But I checked user is authenticated or not.

If the user orders the products Need to authenticated.So going to SigninPage.

I passed the query params in nav.push.user after signin.

Here is my code

this.navCtrl.push('CustomershippingPage',{Page:'Signin'});
.
Going to CustomershippingPage.

If user go to back click nav backbutton.

I Check the query params value is Signin and page is pop to cartPage

Here is my code.

if(this.Page == 'Signin')
  	 {
  	    this.navCtrl.popTo('CartPage');	
  	 }

But it does not work.The page is pop to Signinpage.why?