# 2 different root state layouts?

**URL:** <https://forum.ionicframework.com/t/2-different-root-state-layouts/12078>\
**Category:** ionic-v1\
**Created:** [November 2, 2014, 10:35pm UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078 "2014-11-02T22:35:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbrown](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rbrown](https://forum.ionicframework.com/u/rbrown)\
**Post date:** [November 2, 2014, 10:35pm UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078/1 "2014-11-02T22:35:38Z")

</div>

I am trying to create an Ionic app that has two “root” layouts. One will be a tab layout with 3 tabs, and will handle Login, Register, About, Contact Us, and Forgot Password. Once the user authenticates, I want to have another root state that contains a side menu and the rest of the applications functionality.

My index.html page has one, un-named ion-nav-view in it, and the tabbed state that loads the other tabs is all setup and working great. What do I have to do to create a new root level layout so that when I route to that state, the tabs are no longer present and the the man content area has a view and is part of a side menu layout container? Do I need to have both ion-nav-view elements in the index.html file, with different names? Or do I route a new view within the outer ion-nav-view that will then contain the side menu element and content?

An example on root layout switching would be ideal here…thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [November 3, 2014, 7:03am UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078/2 "2014-11-03T07:03:07Z")

</div>

I use those layouts in my apps.

your have one index.html with your unnamed ion-nav-view

your routes for that:

```
            .state('login', {
                url: '/login',
                templateUrl: 'login.html',
                controller: 'LoginCtrl',
                noAuth: true
            })
            .state('base', {
                url: '/',
                abstract: true,
                views: {
                    '': {
                        templateUrl: 'base.html',
                        controller: 'BaseCtrl'
                    },
                    'sidemenu@base': {
                        templateUrl: 'sidemenu.html',
                        controller: 'SidemenuCtrl'
                    }
                }
            })

```

My abstract base-state (if you are logged in) and the login- state only uses the ion-nav-view from the index.html.  
The base template, has another unnamed ion-nav-view (for all other states) and a named view for the side-menu content.

The noAuth: true flag is a special one for me, to check before state change, if you are trying to access login page, but you are already logged in or you are trying to access a auth-required state, but you are not logged in and so on.

All other state are children of the base-state:

```
           .state('base.dashboard', {
                url: 'dashboard',
                controller: 'DashboardCtrl',
                templateUrl: 'dashboard.html
            })

```

So they are automatically hanging into the base-states nameless ion-nav-view.  
UI-Router states are “relative” by default, so the next fitting ion-nav-view is used.

---

<div class="post-metadata">

**Author:** ![rbrown](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rbrown](https://forum.ionicframework.com/u/rbrown)\
**Post date:** [November 3, 2014, 11:52am UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078/3 "2014-11-03T11:52:31Z")

</div>

Ok, thanks a lot for this, it makes a little more sense. How do you structure the html in the base.html vs the sidemenu.html? Sorry, I’m an ionic noob…I can’t really find a whole lot out there on structuring a more complex layout. Specifically, I’m not sure where to use ion-side-menus, ion-side-menu etc. between the base and the menu. Also, not sure where to put the ion-nav-bar and ion-nav-button that will open the menu. Do those go in the base or the side menu?

Thanks again for all your help!

---

<div class="post-metadata">

**Author:** ![rbrown](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rbrown](https://forum.ionicframework.com/u/rbrown)\
**Post date:** [November 3, 2014, 2:12pm UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078/4 "2014-11-03T14:12:07Z")

</div>

I think I figured it all out…just had to actuallly “read” the docs 😄

Thanks for the clarity you provided, it put me on the right track!

---

<div class="post-metadata">

**Author:** ![appcoder04](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@appcoder04](https://forum.ionicframework.com/u/appcoder04)\
**Post date:** [September 28, 2016, 3:17pm UTC](https://forum.ionicframework.com/t/2-different-root-state-layouts/12078/5 "2016-09-28T15:17:54Z")

</div>

Hi Your approach is good but difficult implementing in one scenario i.e more better clear from this topic

> [Nested abstract views tabs and side menu](https://forum.ionicframework.com/t/nested-abstract-views-tabs-and-side-menu/35627)
