$ionicHistory.backView has incorrect state when go to previous state manually

前端 未结 2 1773
半阙折子戏
半阙折子戏 2020-12-18 06:29

I did a small experiment: http://codepen.io/hawkphil/pen/NqMomm?editors=101

Here is my state flow (click on the buttons): Home -> Fact1 -> Fact2 -> Fa

2条回答
  •  借酒劲吻你
    2020-12-18 07:22

    My solution/workaround:

    Create an additional state to traverse to that references the same url, templateUrl, and controller.

    For example if I have:

    $stateProvider.state('fact2', { url: '/fact2/:factFilter', templateUrl: 'fact2.html', controller: 'Fact2Ctrl' })

    Then I also create a "fact2" duplicate with only a different state name

    $stateProvider.state('fact2_duplicate', { url: '/fact2/:factFilter', templateUrl: 'fact2.html', controller: 'Fact2Ctrl' })

    If I am receiving the funny transition behavior, I can call $state.go('fact2_duplicate') and the history will be more inline to what I am expecting.

    Hope this helps someone.

提交回复
热议问题