title: $ionicHistory.backView has incorrect state when go to previous state manually
body: <p>I did a small experiment: <a href="http://codepen.io/hawkphil/pen/NqMomm?editors=101">http://codepen.io/hawkphil/pen/NqMomm?editors=101</a></p>
  
  <p>Here is my state flow (click on the buttons): <code>Home -&gt; Fact1 -&gt; Fact2 -&gt; Fact3 -&gt; Fact2</code></p>
  
  <p>On each state change, I am showing in <code>console.log</code> for <code>$ionicHistory.backView</code> 
  However, you can see in <code>pen.js:64</code> line, weird things happen. The <code>$ionicHistory.backView</code> "thinks" that I got to <code>app.fact2</code> from a back button, and it shows <code>app.fact1</code> as the previous state (line <code>pen.js:53</code>). This is incorrect, right? It should show <code>app.fact3</code> as the previous state because I got to <code>app.fact2</code> state <strong>MANUALLY</strong> by clicking the button. I also showed the value from <code>$timeout</code> (line <code>pen.js:59</code>) just in case it's slow. But it's still incorrect.</p>
  
  <pre><code>pen.js:56 stateChangeSuccess
  pen.js:64 State change from: tabs.home to: tabs.fact1
  pen.js:52 $scope.$watch $ionicHistory.backView change detect. newVal:
  pen.js:53 tabs.home
  pen.js:58 $timeout after 2 sec $ionicHistory.backView().stateName
  pen.js:59 tabs.home
  pen.js:56 stateChangeSuccess
  pen.js:64 State change from: tabs.fact1 to: tabs.fact2
  pen.js:52 $scope.$watch $ionicHistory.backView change detect. newVal:
  pen.js:53 tabs.fact1
  pen.js:58 $timeout after 2 sec $ionicHistory.backView().stateName
  pen.js:59 tabs.fact1
  pen.js:56 stateChangeSuccess
  pen.js:64 State change from: tabs.fact2 to: tabs.fact3
  pen.js:52 $scope.$watch $ionicHistory.backView change detect. newVal:
  pen.js:53 tabs.fact2
  pen.js:58 $timeout after 2 sec $ionicHistory.backView().stateName
  pen.js:59 tabs.fact2
  pen.js:56 stateChangeSuccess
  pen.js:64 State change from: tabs.fact3 to: tabs.fact2
  pen.js:52 $scope.$watch $ionicHistory.backView change detect. newVal:
  pen.js:53 tabs.fact1
  pen.js:58 $timeout after 2 sec $ionicHistory.backView().stateName
  pen.js:59 tabs.fact1
  </code></pre>
  
  <p><strong>QUESTION</strong></p>
  
  <ol>
  <li><p>How to correct this behavior? Maybe rewrite this delegate or override it somehow?</p></li>
  <li><p>Is there a workaround? As I rely on the correct <strong>previous state</strong> in order to show/hide something.</p></li>
  </ol>
  
  <p><strong>JS</strong></p>
  
  <pre><code>angular.module('ionicApp', ['ionic'])
  
  .config(function($stateProvider, $urlRouterProvider) {
  
    $stateProvider
      .state('tabs', {
        url: "/tab",
        abstract: true,
        templateUrl: "templates/tabs.html",
        controller: "MainCtrl"
      })
      .state('tabs.home', {
        url: "/home",
        views: {
          'home-tab': {
            templateUrl: "templates/home.html",
            controller: 'HomeTabCtrl'
          }
        }
      })
      .state('tabs.fact1', {
        url: "/fact1",
        views: {
          'home-tab': {
            templateUrl: "templates/fact1.html",
            controller: 'Fact1TabCtrl'
          }
        }
      })
      .state('tabs.fact2', {
        url: "/fact2",
        views: {
          'home-tab': {
            templateUrl: "templates/fact2.html",
            controller: 'Fact2TabCtrl'
          }
        }
      })
      .state('tabs.fact3', {
        url: "/fact3",
        views: {
          'home-tab': {
            templateUrl: "templates/fact3.html",
            controller: 'Fact3TabCtrl'
          }
        }
      })
      .state('tabs.about', {
        url: "/about",
        views: {
          'about-tab': {
            templateUrl: "templates/about.html"
          }
        }
      })
      .state('tabs.navstack', {
        url: "/navstack",
        views: {
          'about-tab': {
            templateUrl: "templates/nav-stack.html"
          }
        }
      });
  
  
     $urlRouterProvider.otherwise("/tab/home");
  
  })
  
  .controller('MainCtrl', function($scope, $rootScope, $timeout, $ionicHistory) {
      $scope.$watch(function() {
      return $ionicHistory.backView() ? $ionicHistory.backView().stateName : null;
    }, function (newVal, oldVal) {
      console.log('$scope.$watch $ionicHistory.backView change detect. newVal:');
      console.log(newVal);
    });
  
      $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){ 
      console.log('stateChangeSuccess');
  
      $timeout(function(){ 
        console.log('$timeout after 2 sec $ionicHistory.backView().stateName');
        console.log($ionicHistory.backView().stateName);
      }, 2000);
      });
  })
  
  .controller('HomeTabCtrl', function($scope, $rootScope) {
    // console.log('Home');
  
    $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){ 
      console.log('State change from: ' + fromState.name + ' to: ' + toState.name);
    });
  })
  
  .controller('Fact1TabCtrl', function($scope) {
    // console.log('Fact1');
  })
  
  .controller('Fact2TabCtrl', function($scope) {
    // console.log('Fact2');
  })
  
  .controller('Fact3TabCtrl', function($scope) {
    // console.log('Fact3');
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;html ng-app="ionicApp"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
  
    &lt;title&gt;Navigation Example&lt;/title&gt;
  
    &lt;link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"&gt;
    &lt;script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;ion-nav-bar class="bar-positive"&gt;
      &lt;ion-nav-back-button class="button-icon ion-arrow-left-c"&gt;
      &lt;/ion-nav-back-button&gt;
    &lt;/ion-nav-bar&gt;
  
    &lt;ion-nav-view&gt;&lt;/ion-nav-view&gt;
  
  
    &lt;script id="templates/tabs.html" type="text/ng-template"&gt;
      &lt;ion-tabs class="tabs-icon-top tabs-positive"&gt;
  
        &lt;ion-tab title="Home" icon="ion-home" href="#/tab/home"&gt;
          &lt;ion-nav-view name="home-tab"&gt;&lt;/ion-nav-view&gt;
        &lt;/ion-tab&gt;
  
        &lt;ion-tab title="About" icon="ion-ios-football" href="#/tab/about"&gt;
          &lt;ion-nav-view name="about-tab"&gt;&lt;/ion-nav-view&gt;
        &lt;/ion-tab&gt;
  
        &lt;/ion-tab&gt;
  
      &lt;/ion-tabs&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/home.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="Home"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;p&gt;
            &lt;a class="button icon ion-home" href="#/tab/home"&gt; Home&lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact1"&gt;
              Fact1
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact2"&gt;
              Fact2
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact3"&gt;
              Fact3
            &lt;/a&gt;
          &lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/fact1.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="Fact1"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;p&gt;
            &lt;a class="button icon ion-home" href="#/tab/home"&gt; Home&lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact1"&gt;
              Fact1
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact2"&gt;
              Fact2
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact3"&gt;
              Fact3
            &lt;/a&gt;
          &lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/fact2.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="Fact2"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;p&gt;
            &lt;a class="button icon ion-home" href="#/tab/home"&gt; Home&lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact1"&gt;
              Fact1
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact2"&gt;
              Fact2
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact3"&gt;
              Fact3
            &lt;/a&gt;
          &lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/fact3.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="Fact3"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;p&gt;
            &lt;a class="button icon ion-home" href="#/tab/home"&gt; Home&lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact1"&gt;
              Fact1
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact2"&gt;
              Fact2
            &lt;/a&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/fact3"&gt;
              Fact3
            &lt;/a&gt;
          &lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/about.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="About"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;h3&gt;Create hybrid mobile apps with the web technologies you love.&lt;/h3&gt;
          &lt;p&gt;Free and open source, Ionic offers a library of mobile-optimized HTML, CSS and JS components for building highly interactive apps.&lt;/p&gt;
          &lt;p&gt;Built with Sass and optimized for AngularJS.&lt;/p&gt;
          &lt;p&gt;
            &lt;a class="button icon icon-right ion-chevron-right" href="#/tab/navstack"&gt;Tabs Nav Stack&lt;/a&gt;
          &lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
    &lt;script id="templates/nav-stack.html" type="text/ng-template"&gt;
      &lt;ion-view view-title="Tab Nav Stack"&gt;
        &lt;ion-content class="padding"&gt;
          &lt;p&gt;&lt;img src="http://ionicframework.com/img/diagrams/tabs-nav-stack.png" style="width:100%"&gt;&lt;/p&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
    &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>