# Multiple instance of the page on log in

**URL:** <https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060>\
**Category:** ionic-v3\
**Created:** [January 3, 2018, 4:47am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060 "2018-01-03T04:47:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevred](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kevred](https://forum.ionicframework.com/u/kevred)\
**Post date:** [January 3, 2018, 4:47am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/1 "2018-01-03T04:47:41Z")

</div>

I have a log in page. on success i am pushing to a tabs page that i get when i start my project my using tabs.`(ionic start myApp tabs)`.

There is a logout page in one of the tabs, when i click it i need to go to the login page and start my app as new.

Below are the codes that i am using to navigate

`login.ts`

```auto
this.navCtrl.push(TabsPage);

```

```auto
tabs.html

```

```auto
<ion-tabs>
	<ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
	<ion-tab [root]="tab2Root" tabTitle="Settings" tabIcon="settings"></ion-tab>
	<ion-tab [root]="tab3Root" tabTitle="Logout" tabIcon="power"></ion-tab>
</ion-tabs>

```

`logout.ts`

```auto
private app:App

this.app.getRootNav().setRoot(LoginPage);

```

My problem is ,

on logout the page is directed back to the login page alright.  
But when i log in again i get two home pages, stacked twice,

and then i logout again and then log back in, the pile of pages increased to three.  
And it increases further. How do i solve this?

---

<div class="post-metadata">

**Author:** ![anna\_liebt](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@anna\_liebt](https://forum.ionicframework.com/u/anna_liebt)\
**Post date:** [January 3, 2018, 9:03am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/2 "2018-01-03T09:03:56Z")

</div>

Hello,

NavController is a stack. Each time you push a page you put this page on the stack.  
You can remove pages with using pop or remove see doc.

> **[Ionic Framework](https://ionicframework.com/docs/api/navigation/NavController/#remove)**
>
> Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards

Best regards, anna-liebt

---

<div class="post-metadata">

**Author:** ![Jacktoolsnet](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jacktoolsnet/32/107318_2.png) [@Jacktoolsnet](https://forum.ionicframework.com/u/Jacktoolsnet)\
**Post date:** [January 3, 2018, 9:14am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/3 "2018-01-03T09:14:54Z")

</div>

Use setRoot(‘TabsPage’) and also use setRoot when you log out to switch back to the login page.

---

<div class="post-metadata">

**Author:** ![kevred](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kevred](https://forum.ionicframework.com/u/kevred)\
**Post date:** [January 3, 2018, 9:37am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/4 "2018-01-03T09:37:00Z")

</div>

My root page is not the tabs page but the loginpage

on successful log in it is pushed into the tabspage

---

<div class="post-metadata">

**Author:** ![Jacktoolsnet](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jacktoolsnet/32/107318_2.png) [@Jacktoolsnet](https://forum.ionicframework.com/u/Jacktoolsnet)\
**Post date:** [January 3, 2018, 9:55am UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/5 "2018-01-03T09:55:48Z")

</div>

Yes I understand that. But to solve your problem you shoud use the navCtr.setRoot function to switch to the tabs page.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:57pm UTC](https://forum.ionicframework.com/t/multiple-instance-of-the-page-on-log-in/117060/6 "2021-07-19T21:57:09Z")

</div>

Closed on July 19, 2021, 9:57pm UTC


