Tour breaks when tour has tour-step-enabled="false" and tour-step-on-next="redirectTo" on it
Opened this issue · 1 comments
Hello, thanks for you work on this project, very appreciated.
I am using the exact versions of the following:
- Browser: Google Chrome Version 60.0.3112.90 (Official Build) (64-bit)
- AngularJS: 1.6.5
- Angular Bootstrap: 2.5.0
- Angular UI Tour: 0.8.2
- Angular UI Router: 0.4.2
I have installed this library via: Bower
I have observed the following behavior:
I have around 25 steps on different pages and I need to check whether user has permission to see some steps. Now I have issue when my step with on-next
redirect is disabled the tour breaks down, because redirect function wasn't run and I have no next enabled step on my page.
This is how I expected it to behave:
Maybe I could run on-next
redirect function for last disabled step before enabled one?
Is there some solution to this case? Thanks.
Here is my tour config, and all related step configs:
uiTourService.createDetachedTour('MyTour', {
backdrop: true,
useUiRouter: true,
templateUrl: 'views/tour/tour_step.html',
scrollOffset: 250,
});
tour-step="currentTourStepId"
tour-step-order="3"
tour-step-placement="top"
tour-step-title="CurrentStepTitle"
tour-step-content="CurrentStepContent"
tour-enabled="$ctrl.checkPermissions('currentTourStepId')"
tour-step-on-next="tourRedirect('next.state', { ...nextParams }, 'nextStepId')"
tour-step="nextStepId"
tour-step-order="4"
tour-step-placement="right"
tour-step-title="NextStepTitle"
tour-step-content="NextStepContent"
tour-enabled="$ctrl.checkPermissions('nextStepId')"
tour-step-on-next="tourRedirect('nextnext.state', { ...nextnextParams }, 'nextnextStepId')"
Additional notes/code:
$scope.tourRedirect = function (state, params, nextStepId) {
if (!$scope.currentTour) {
return;
}
$state.go(state, params);
return $scope.currentTour.waitFor(nextStepId);
};
Hey @RusinovAnton, I think the only way I can make a change to help is to expose the getNextStep()
function which will tell you if the next enabled step is before or after the redirect. I don't want to start adding more data to the scope because that adds complexity, but exposing more on the tour object could be useful. It would still be a private function for now though, so using it would be at your own risk of unreported breaking changes.