# 2 routers that share templates

**URL:** <https://forums.fusetools.com/t/2-routers-that-share-templates/4941>\
**Category:** How-to Discussions\
**Created:** [November 22, 2016, 3:05pm UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941 "2016-11-22T15:05:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaulin](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zaulin](https://forums.fusetools.com/u/zaulin)\
**Post date:** [November 22, 2016, 3:05pm UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941/1 "2016-11-22T15:05:56Z")

</div>

Hi!

i don’t know if that’s a bug of if i should change something as it’s the expected behavior:

I have 2 tabs (each one with it’s router/navigator):

- newsFeeds
- search

from both pages you can navigate to the user profile page and then to it’s friends page so they share templates.

The problem is that after navigating forward in both pages when “router.goBack()” mixes the navigation history:

for example:

newsFeedsPage --\> Profile (user1) --\> Friends (user1)

then:

searchPage --\> Profile (user2) --\> Friends (user2)

then go back to newsFeedPage (now on “Friends (user1)”) and call “router.goBack” it will go back to “Profile (user2)”

```
<PageControl ux:Name="MainPager" Active="{pageControlActivePage}" Interaction="None">
    <Page ux:Name="newsFeedsPage">

        <Router ux:Name="routerNews" BackButtonAction="None"/>
        <Navigator DefaultPath="newsFeedsMainPage">
            <NewsFeedsMainPage Name="newsFeedsMainPage" router="routerNews"/>
            
            <ProfilePage ux:Template="profilePage" router="routerNews" />
            <FriendsPage ux:Template="friendsPage" router="routerNews" />
        </Navigator>

    </Page>

    <Page ux:Name="searchPage">
        <Router ux:Name="routerSearch" BackButtonAction="None"/>
        <Navigator DefaultPath="searchMainPage">
            <SearchMainPage Name="searchMainPage" router="routerSearch"/>

            <ProfilePage ux:Template="profilePage" router="routerSearch" />
            <FriendsPage ux:Template="friendsPage" router="routerSearch" />
        </Navigator>
    </Page>
```

---

<div class="post-metadata">

**Author:** ![edA-qa\_mort-ora-y](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/eda-qa_mort-ora-y/32/124_2.png) [@edA-qa\_mort-ora-y](https://forums.fusetools.com/u/edA-qa_mort-ora-y)\
**Post date:** [November 29, 2016, 2:32pm UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941/2 "2016-11-29T14:32:11Z")

</div>

The preferred way to use a `Router` is to have one in the app and manage the top-level navigation that way as well.

If you do need two `Router` instances (for example to maintain separate history) you need to put `IsMasterRouter="false"` on them.

IF that doesn’t work then we’ll need to see the JS that is doing the routing operations.

---

<div class="post-metadata">

**Author:** ![zaulin](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zaulin](https://forums.fusetools.com/u/zaulin)\
**Post date:** [November 29, 2016, 2:45pm UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941/3 "2016-11-29T14:45:58Z")

</div>

it solved the problem!!

did not know that IsMasterRouter=“false” was needed

thnx!!!

---

<div class="post-metadata">

**Author:** ![Christer\_V\_Aas](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/christer_v_aas/32/62_2.png) [@Christer\_V\_Aas](https://forums.fusetools.com/u/Christer_V_Aas)\
**Post date:** [May 19, 2017, 10:59am UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941/4 "2017-05-19T10:59:23Z")

</div>

Is it possible to have 3 routers in one page? The main one in the app as a dependency, the second to control an internal PageControl with tabs, and the third to control some deep navigation, but be able to do goBack using the first router?

I loose the connection between the router defined on a page and the pagecontrol when introducing a third one.

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [May 19, 2017, 1:26pm UTC](https://forums.fusetools.com/t/2-routers-that-share-templates/4941/5 "2017-05-19T13:26:10Z")

</div>

Hi Christer,

this sounds like a complex enough challenge to deserve its own forum post with some example code / complete repro. Otherwise the question (and answer to it) would remain highly theoretical.
