Ionic a route design that jumps to the same view and preserves history in different view
On the code: State inside new Add a status
. State ( "/other", Span class= "Hljs-keyword" >abstract: true, Controller: " <ion-nav-view></ion-nav-view> ", OnEnter: function ($ Rootscope, Fromstateserv) {fromstateserv.setstate ( "other", $rootScope. Fromparams); }})
The corresponding controller
. Controller ( "Otherctrl", < Span class= "Hljs-keyword" >function ( $scope, $state, Fromstateserv) { $scope. Backnav = < Span class= "Hljs-keyword" >function () {var fromState = Fromstateserv.getstate ( "other"); if (fromstate.fromstate!== undefined) { $state. Go ( FromState.fromState.name, Fromstate.fromparams); } else {//set without history, the default jump $ State.go ( "app.xxx");}};
Keep the public methods of history
.factory("fromStateServ", function() { return { data: {}, setState: function(module, fromState, fromParams) { this.data[module] = { "fromState": fromState, "fromParams": fromParams }; }, getState: function(module) { return this.data[module]; } };})
https://segmentfault.com/n/1330000004202748
Ionic different view jumps to the same