$ionicHistory.goBack(); does not work in 1.3.0


#1

$ionicHistory.goBack(); does not work when i update my project to 1.3.0. But it does work if i downgrade it back to 1.2.4. With no other changes. I started i new project, and $ionicHistory.goBack() does work with 1.3.0 in a clean project. But still in my project when i update to 1.3.0 it quits working. Again no other changes other than executing the “ionic lib update” command.

If i could reproduce it in a clean project i would submit a github issue.

The only thing i can think of is maybe because my bower.json has these resolutions.

  "resolutions": {
    "angular-animate": "1.5.3",
    "angular": "1.5.3",
    "angular-sanitize": "1.5.3"
  }

and i had to put those in order to get the “ionic-platform-web-client” to install.

Your system information:

Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS
Node Version: v5.0.0


#2

Same problem here… Any fixes?


#3

Also seeing the same problem


#4

same problem here, i found that when console.log($ionicHistory.viewHistory());
the backView is null if the next view is in different history stack in 1.3.0.

However in 1.2.4, the backView is available even both view is in different history stack


#5

Could you open an issue for this on github?


#6

Just created this issue.

Thanks,


#7

Hello everyone,

Does anyone have a simple to reproduce example of this?

Update: I have not been able to reproduce this. Can someone provide more context/recreation steps so I can figure it out?

Thanks,
Dan


#8

Hi @soocheng,

Is your app a tabs app? Yes, we did intentionally make this change. This is by design. If it’s not a tabs app, there may be a legitimate bug there.

Please let me know.

Thanks,
Dan


#9

Hi, don’t know what is the bug @babinc has, but i was having this problem with a tabs app. What should be the proper way to do it now? It’s a simple app with some tabs with a list of items / details.


#10

@maraat,

We decided that we would not support cross-tab “history”, meaning that back button and goBack should only effect the current tab. Does that make sense?

This was actually a bug that it ever worked that way. We never intended to support cross-tab history. This follows iOS conventions and matches how Ionic 2 works. If the community feels strongly about this, we could reconsider and revert the change. We think it’s the right UX the way it is now, though.

Thanks,
Dan


#11

I agree with you that this seems the logic thing to do, but don’t know if going from a tab template to a single view (not attached to the tabs) would be considered cross tabs.

Thanks anyway


#12

We’re doing a lot of tab to single page transitions in our app, and this latest change breaks the app. Please consider adding an option to allow this functionality! Are there any workarounds in the meantime?


#13

My app is also a tabs apps. I use the $ionicHistory.goBack() when going from a state without the tabs, back to a state with the tabs. Not sure if that helps. But that is just how my app is layed out. This is not exact code of my app. But I use the $ionicHistory.goBack() when going from ‘someOtherState’ to possibly ‘tab.home’ (if that was the last page).

  .state('tab', {
    url: "/tab",
    abstract: true,
    templateUrl: "views/tabs.html"
  })

  .state('tab.home', {
    url: "/home",
    views: {
      'home-tab': {
        templateUrl: "views/app/home.html",
        controller: 'homeController'
      }
    }
  })

.state('someOtherState', {
    url: "/someOtherState",
    templateUrl: "views/app/someOtherState.html",
    controller: 'someOtherStateController'
  })

#14

@Babinc @willtogga That’s exactly my problem also.


#15

So how are we supposed to do this now? Have the tabs shown the whole time? Facebook, Instagram, and the Twitter app seem to use cross-tab history. With some pages that have tabs and some that do not.


#16

Let me take a look and see what I can do. Worst case - we just revert the change.

Thanks,
Dan


#17

@danbucholtz Any updates about this?


#18

Yes. We are going to revert the change. I will follow up in this thread. It will be in 1.3.1 but a nightly build before then.

Thanks,
Dan


#19

@danbucholtz Thanks for the info! :beers: I’ll be expecting the update


#20

Great news. :slight_smile: Thank!