diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 1c855131d4..c9c4fded52 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -620,7 +620,12 @@ angular.module('ionic.service.view', ['ui.router']) return null; }; View.prototype.go = function(opts) { - if(this.url && this.url !== $location.url() && (!opts || opts.enableUrlChange !== false)) { + + if(this.stateName) { + return $state.go(this.stateName, this.stateParams); + } + + if(this.url && this.url !== $location.url()) { if($rootScope.$viewHistory.backView === this) { return $window.history.go(-1); @@ -628,11 +633,8 @@ angular.module('ionic.service.view', ['ui.router']) return $window.history.go(1); } - return $location.url(this.url); - } - - if(this.stateName) { - return $state.go(this.stateName, this.stateParams); + $location.url(this.url); + return; } return null; @@ -696,6 +698,13 @@ angular.module('ionic.service.view', ['ui.router']) rsp.historyId = forwardView.historyId; } + } else if(currentView && currentView.historyId !== hist.historyId && + hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length && + hist.stack[hist.cursor].stateId === currentStateId) { + // they just changed to a different history and the history already has views in it + rsp.viewId = hist.stack[hist.cursor].viewId; + rsp.navAction = 'moveBack'; + } else { // set a new unique viewId @@ -754,6 +763,10 @@ angular.module('ionic.service.view', ['ui.router']) hist.cursor = viewHistory.currentView.index; + $rootScope.$broadcast('$viewHistory.historyChange', { + showBack: (viewHistory.backView && viewHistory.backView.historyId === viewHistory.currentView.historyId) + }); + return rsp; }, @@ -2881,7 +2894,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu }, template: '