title: AngularJS: Unable to invoke controller from a promise
body: <p>I am a newbie with AngularJS/Ionic, and am facing a problem with the following piece of code: </p>
  
  <pre><code>.controller('myCtrl', function ($scope, $http, $ionicPopover, $state, $cordovaOauth){
  
  //The following is used in the ng-click of a button
  $scope.doAction = function () {
      $cordovaOauth.google("xxxxxx.apps.googleusercontent.com", ["email"]).then(function (result) {
          // results
          alert(JSON.stringify(result));
          $scope.google_access_token = result.access_token;
  
          var http = $http({
              url: 'https://www.googleapis.com/oauth2/v3/userinfo',
              method: 'GET',
              params: {
                  access_token: result.access_token
              }
          });
          http.then(function (data) {
              var user_data = data.data;
              //The code is reaching here, as the alert is successfully shown with data 
              alert("Name: " + user_data.name + "\nEmail: " + user_data.email
                  +"\nPicture:" + user_data.picture);
              userInfo.fullName = user_data.name;
              userInfo.userId = user_data.email;
              userInfo.img = user_data.picture;
              localStorage.setItem('loggedInUser', user_data.email);
              //But this is not taking me to the other controller 
              $state.go('tabsController.someOtherController');
          });
  
      }, function (error) {
          // error
          alert(error);
      });
    }
  
  }
  </code></pre>
  
  <p>As I mentioned in the comments in the code, the execution reaches inside http.then but it is not invoking the other controller with $state.go. If I place it before doAction(), then it is getting invoked, which means there is nothing wrong with the controller itself. Can someone please help identify what am I doing wrong here? </p>