# View state in tab

**URL:** <https://forum.ionicframework.com/t/view-state-in-tab/11240>\
**Category:** ionic-v1\
**Created:** [October 16, 2014, 8:51am UTC](https://forum.ionicframework.com/t/view-state-in-tab/11240 "2014-10-16T08:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragec](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@dragec](https://forum.ionicframework.com/u/dragec)\
**Post date:** [October 16, 2014, 8:51am UTC](https://forum.ionicframework.com/t/view-state-in-tab/11240/1 "2014-10-16T08:51:57Z")

</div>

Hi, just started to trying out Ionic.  
I’m trying to set up application with 2 tabs, of which one will be leaflet.js map. So I have set up my mapController where I initialize leaflet map object.

The problem is that when I switch tabs, all map settings (zoom, position, etc.) get lost. As I can see, this is becuase everytime I switch back to map tab, controller creates new map instance with default settings.

As I see, same behaviour is also in demo:  
[http://ionicframework.com/docs/api/directive/ionTabs/](http://ionicframework.com/docs/api/directive/ionTabs/)  
If you scroll to task 24, then switch tabs, view will be reset to top.

So, the question is: how can I maintain view state while switching tabs (like when switching tabs in web browser)? Should I use some other component?

---

<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:** [October 16, 2014, 3:39pm UTC](https://forum.ionicframework.com/t/view-state-in-tab/11240/2 "2014-10-16T15:39:17Z")

</div>

Just note that that codepen is a bit out of date,

> **[Tabs And Navigation: Nightly](https://codepen.io/ionic/pen/odqCz)**
>
> Demo showing how each tab has its own history stack. Navigating between each tab remembers the correct back and forward views that were visited....

If you are using beta 13, ionic should maintain everything properly.  
Can you provide an example codepen?
