$state.go not changing state


#1

I saw a similar post superficially similar to this one before posting, but my issue is different enough that rather than continue/hijack that thread I thought I should start my own.

Despite the fact that my app has no need of tabs I started with the tabs demo.
I’m glad I did because I found out about $state & all that goodness.

I did some research on how to create my own routes and states, but let me simplify this as much as possible.

My app consists of exactly 2 states, “default” and "config"
default is nothing more than a series of directives that are hidden or shown depending on current user interaction.

config is supposed to be a hidden state and only accesible via a toggle.
When the app is in the config screen, everything going on behind the scenes is supposed to stop. The user is supposed to enter config data, then hit the toggle and be dropped back off at the landing screen.

This “halfway” works. I’ve got the hidden toggle and clicking on it from anywhere in the app will launch the config screen. However once I’m in the config screen I can’t seem to get back to the default screen.

This is my toggle

$scope.toggle = function(){ console.log("state is: ",$state.current); if($state.is("default")){ $state.go("config"); }else{ $state.go("default"); } };

My state providers look like

$stateProvider .state('default', { url: '/default', views: { 'view-default': { templateUrl: 'templates/view-default.html', controller: 'HomeCtrl' } } }) .state('config', { url: '/config', views: { 'view-config': { templateUrl: 'templates/view-config.html', controller: 'ConfigCtrl' } } });

I have both views and the toggle button right in index.html

<**div ng-controller="ConfigCtrl"> <**a ng-click="show()"><**img src="img/hidden2px.png"><**/a> <**/div>

<ion-nav-view name=“view-default”></ion-nav-view>
<ion-nav-view name=“view-config”></ion-nav-view>

There are no errors, and I can plainly see the toggle “trying” to occur and the values from that console.log are what would be expected had the state actually change. Yet the config screen just stays on top no matter what I do.

I’m not at all sure what to try next here and I’m hoping someone has solved something similar.

Thanks!