benmarch / angular-ui-tour

Product tour using Angular UI Bootstrap Tooltips
163 stars 49 forks source link

How to implement navigateToAndWaitFor with a detached tour #146

Closed abhipanda closed 7 years ago

abhipanda commented 7 years ago

How to implement navigateToAndWaitFor with a detached tour, trying to navigate to another page using uiRouter

uiTourService.createDetachedTour
tour.createStep

I don't use any HTML directives

benmarch commented 7 years ago

Something like this should work:

const tour = uiTourService.createDetachedTour('myTour', tourOptions);

tour.createStep({
  stepId: 'firstStep',
  onNext: function () {
    $state.go('nextState');
    return tour.waitFor('secondStep');
  }
});

tour.createStep({
  stepId: 'secondStep',
  onPrev: function () {
    $state.go('prevState');
    return tour.waitFor('firstStep');
  }
});
abhipanda commented 7 years ago

Awesome ! It works thanks.