Passing data to next page and then making the page the rootpage

I want to pass data to the next page, using :

     this.navCtrl.push(NextPage, { data : somedata}

But I also want to make NextPage the rootpage using setRoot :

    this.navCtrl.setRoot(NextPage);

Unfortunately, I don’t know how to do both. My current work around with a promise doesn’t pass the data to the next page, but only makes it the root :

   this.navCtrl.push(NextPage, { data : somedata}).then(()=>{
        this.navCtrl.setRoot(NextPage)
   };

So anyone, how can I do both? Please help me find a work around

setRoot() allows you to pass params directly.

Hey rapropos!

    so could I do this ?
     
    this.navCtrl.setRoot(NextPage, { data : somedata} );

Ask TFM.

@Sidharth_1999 you can using this below code

itemTapped(event, item) {
		this.navCtrl.setRoot(nextpage, {
		  item: item
		});
	}

Yeah! I guess you can pass data the same way using setRoot. Awesome!

@Sidharth_1999 if your problem is fix.please mark the solution .