Weird navigation bug, with side menu, routing views won’t update

I am fairly new to ionic (using the 1.0.0 beta1) and Angular, and I am working on my first project, where I experience weird bugs, I cannot understand.

My app is based on the "Ionic Book" task app, described here: http://ionicframework.com/docs/guide/building.html.

Here's the link to my app: http://plnkr.co/edit/zp49fsbmOfMiQfXDopxt?p=preview1

In my version of the task-app, the tasks are called "instances" and each instance has several "categories" in it. Each category has a title and a status. The user can enter instances in the side menu, via the '+' button. And each instance is created with some dummy categories. The user can choose his instances and then choose a category to see its status.

To see what bugs occur, please visit my app http://plnkr.co/edit/zp49fsbmOfMiQfXDopxt?p=preview1 and add a few instances with dummy titles like a, b, c, d. The url form may remain empty, it is not yet needed. Don't click on a category yet. You will notice the switching from one category to another works as expected (though all instances have the same categories).

Now when you click on a category in an instance, say in instance b, the view shows the category status, with the right category title in the nav-bar. When you now click on the back button, the mess starts:

If you now click on any category, the view always displays the category, which you clicked at first! Not the one you want to see. Also, if I now change the instance (say to instance a) and try to switch back to instance b, the switch will not be performed (the title remains a)!

I really can't see where those bugs come from, as the localeStorage seems to be updated on clicks! (check the lastActiveInstance and lastActiveCat variables in localStorage!)

Do you guys see where my mistake is? By this time I think it must be some fundamental problem with the $stateProvider and the back button? I'd really appreciate your help, since I am pretty desperate right now. Thank you

For what I've seen, it looks like you have only one MainCtrl for the whole application, is that right?

It looks like the variables of this controller are only updated once. So your activeInstance will receive it's value when you click for the first time to see the category, but then if you come back and click again on anything, the value of this variable is not being updated. You're calling selectCat function but I don't see it updating the values of activeInstance.

I hope it's only that!

It is now fixed with the new ionic 1.0 beta 5b. View title updates as expected. From the changelog:

- List item
 - make it set navbar if title changes back to old value (919d4f8d, closes #1121)