$state.go leads me to the otherwise statement and does not transition to the right state


#1

I am trying to move into the menu.home state but when I do $state.go('menu.home) it does not do anything and it goes into the otherwise statement. Not sure what I am doing wrong.

Controller.js

$state.go(‘menu.home’);
routes.js

angular.module('app.routes', [])

.config(function($stateProvider, $urlRouterProvider) {

// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state’s controller can be found in controllers.js
$stateProvider

.state(‘login’, {
cache: false,
url:’/login’,
templateUrl: ‘templates/login.html’,
controller: ‘LoginCtrl’
})

.state(‘menu.home’, {
cache: false,
url: ‘/home’,
views: {
‘side-menu21’: {
templateUrl: ‘templates/home.html’,
controller: ‘MapCtrl’ //‘homeCtrl’
}
}
})

.state(‘menu.cart’, {
url: ‘/page2’,
views: {
‘side-menu21’: {
templateUrl: ‘templates/cart.html’,
controller: ‘cartCtrl’
}
}
})

.state(‘menu.cloud’, {
url: ‘/page3’,
views: {
‘side-menu21’: {
templateUrl: ‘templates/cloud.html’,
controller: ‘cloudCtrl’
}
}
})

.state(‘menu.test’, {
cache: false,
url: ‘/test’,
views: {
‘side-menu21’: {
templateUrl: ‘templates/test.html’,
controller: ‘testCtrl’
}
}
})

.state(‘menu’, {
url: ‘/side-menu21’,
templateUrl: ‘templates/menu.html’,
abstract: true
})

//$urlRouterProvider.otherwise(’/login’)
$urlRouterProvider.otherwise(function($injector, $location) {
console.log("Could not find: " + JSON.stringify($location));
$location.path(’/login’);
})
});

every time I try to do $state.go(‘menu.home’) this is the output i get:

Could not find: {"$$protocol":“http”,"$$host":“localhost”,"$$port":8100,"$$path":"/app/sear ch","$$search": {},"$$hash":"","$$url":"/app/search","$$absUrl":“http://localhost:8100/#/ap p/search”,"$$state":null,"$$replace":false}
login.html

 <ion-view view-title="Login" id="login" name="login-view">
   <ion-content class="padding">

<!--##########################Facebook Login#################################-->
<div class="facebookLogin">
<a class="facebook-sign-in button button-royal" ng-click="facebookSignIn()">Login with Facebook</a>
</div>
<!--#######################END Facebook Login#################################-->

      <div class="list list-inset">

          <label class="item item-input">
              <input type="text" placeholder="Username" ng-model="data.username">
          </label>

          <

label class="item item-input">
              <input type="password" placeholder="Password" ng-model="data.password">
          </label>

      </div>
  <button class="button button-block button-calm" ng-click="login()">Login</button>
home.html
<ion-view title="Test" id="home" class=" ">

<ion-content padding="true" class="has-header"></ion-content>
 <!-- Test button 
<div class="TestButton">
<div class="button button-assertive" ng-click="Test()" ng-hide="hideTestButton">
  <a class="button">Test</a>
</div>

</div>


End Request Test button----------->
  <ion-tabs class="tabs-icon-top">
  <ion-tab title="Apple" icon-off="ion-social-apple" icon-on="ion-social-apple" href="#/app/search" on-select="appleTab()">
    <ion-nav-view name="tab-search"></ion-nav-view>
  </ion-tab>

  <ion-tab title="Windows" icon-off="ion-social-windows" icon-on="ion-social-windows" href="#/app/browse" on-select="windowsTab()">
    <ion-nav-view name="tab-browse"></ion-nav-view>
  </ion-tab>

  <ion-tab title="Mobile" icon-off="ion-iphone" icon-on="ion-iphone" href="#/app/playlists" on-select="mobileTab()">
    <ion-nav-view name="tab-playlists"></ion-nav-view>
  </ion-tab>
  <ion-tab title="Network" icon-off="ion-wifi" icon-on="ion-wifi"" href="#/app/playlists" on-select="otherTab()">
    <ion-nav-view name="tab-playlists"></ion-nav-view>
  </ion-tab>

</ion-tabs>

#2

I am able to transition into menu.test


#3

If I look at $stateProvider in the routes.js it is blank ({ }) for some reason when I do $state.go(‘menu.home’)


#4

If I comment out : $location.path(’/login’); then it works. Not sure why this happens, Please help!