# $state.go() not working

**URL:** <https://forum.ionicframework.com/t/state-go-not-working/65430>\
**Category:** ionic-v1\
**Created:** [October 2, 2016, 10:28am UTC](https://forum.ionicframework.com/t/state-go-not-working/65430 "2016-10-02T10:28:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![priteshpmehta](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/priteshpmehta/32/103076_2.png) [@priteshpmehta](https://forum.ionicframework.com/u/priteshpmehta)\
**Post date:** [October 2, 2016, 10:28am UTC](https://forum.ionicframework.com/t/state-go-not-working/65430/1 "2016-10-02T10:28:23Z")

</div>

Hi,

In my app i am checking network state whether user is online or offline using `$cordovaNetwork` on each request. If user doesn’t have network or if any user goes offline then i want to send user on some other page (other controller). Once user comes back online automatically or by clicking retry button, app should redirect to previous controller again.

I have tried following code but it works only when user goes offline… once he comes online again… it went through it…even it print console log but $state.go() is not working…

```
.controller('MasterController',['$scope', '$state', '$rootScope', '$cordovaNetwork', function ($scope, $state, $rootScope, $cordovaNetwork) {
  
 document.addEventListener("deviceready", function () {

    var type = $cordovaNetwork.getNetwork()

    var isOnline = $cordovaNetwork.isOnline()

    var isOffline = $cordovaNetwork.isOffline()

    // listen for Offline event
    $rootScope.$on('$cordovaNetwork:offline', function(event, networkState){
      var offlineState = networkState;
      console.log("offlineState : " + offlineState);
      $state.go('mainMaster.Offline', {}, {reload: true});
    })

  }, false);
}])   

.controller('OfflineController',['$scope', '$state', '$rootScope', '$cordovaNetwork', function ($scope, $state, $rootScope, $cordovaNetwork) {
  
    document.addEventListener("deviceready", function () {

      var type = $cordovaNetwork.getNetwork()

      var isOnline = $cordovaNetwork.isOnline()

      var isOffline = $cordovaNetwork.isOffline()

      // listen for Online event
      $rootScope.$on('$cordovaNetwork:online', function(event, networkState){
        var onlineState = networkState;
        // i am able to get following log... but $state.go not working..
        console.log("onlineState : " + onlineState);
        $state.go('mainMaster.Dashboard', {}, {reload: true});
      })

      
    }, false);
}])

```

Thank you.
