How to close a page opened using this.app.getRootNav().setRoot


#1

Hi ,

I have opened a page over tabs using
this.app.getRootNav().setRoot('PageName');

Can anyone let me know how to close this page?

Thanks in advance


#2

I don’t think you should have ever opened it that way in the first place.

Separation of concerns is one of the most fundamental design principles, and in this case, the app component is in charge of the root nav, and should be the only one interacting with it. Throwing pointers to App around to other places is an antipattern.

When you fix the design, the answer to this question becomes obvious: either closing that page closes the app or you have to take complete responsibility for setting the root page to something else on any event that might conceivably close it.