javascript - $state.go doesn’t redirect to given path -
I have a view that is outside my tab, now when I try to redirect from that view to that tab I get what I get redirected to the wrong tab I ($ scope, $ state, $ rootsecope, $ ionicPlatform) {$ rootScope. $ ('$ StateChangeStart', function (event, toState, toParam, fromState, fromParams) {// $ scope.from = fromState; Console.log (Settte);}) $ scope.goBack = function () { Console.log ($ scope.from.name); $ State.go ($ scope.from.name);}})
You should apply other answers, but you have another problem.
The other problem is that, when you click on the back button, the state changes on the tab. Volgend (which is correct), but after that the tab is going on. Alert state ... So I'm trying to explain why this second redirect is happening.
Remove from console.log when click on clicki ng back button:
My first candidate is:
$ urlRouterProvider.otherwise ('/ tab / alerts');
You should not use UI-Route with standard routing, so you should add this line next to your controller:
console.log ('Going to the default state'); $ State.go ('tab.alerts'); The second transition is done by the ionic structure, I have put a breakpoint and have checked the callstock, check this capture: 1- Call on first click:
2- Inorganic framework detects changes in url and another transitions run:
I'm reading this structure more so that I understand S But why is this happening ... I update you.
Comments
Post a Comment