Skip to content

Commit

Permalink
Merge pull request #436 from CodeMagic/Fix-showStep()-running-before-…
Browse files Browse the repository at this point in the history
…router.navigate()-is-done

Waiting on router.navigate() to show next step
  • Loading branch information
tnicola authored Nov 19, 2021
2 parents bd0e12d + f1b1078 commit 7c55260
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions projects/ngx-joyride/src/lib/services/joyride-step.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ export class JoyrideStepService implements IJoyrideStepService {
this.tryShowStep(StepActionType.NEXT);
}

private navigateToStepPage(action: StepActionType) {
private async navigateToStepPage(action: StepActionType) {
let stepRoute = this.stepsContainerService.getStepRoute(action);
if (stepRoute) {
this.router.navigate([stepRoute]);
return await this.router.navigate([stepRoute]);
}
}

Expand All @@ -120,8 +120,8 @@ export class JoyrideStepService implements IJoyrideStepService {
});
}

private tryShowStep(actionType: StepActionType) {
this.navigateToStepPage(actionType);
private async tryShowStep(actionType: StepActionType) {
await this.navigateToStepPage(actionType);
const timeout = this.optionsService.getWaitingTime();
if (timeout > 100) this.backDropService.remove();
setTimeout(() => {
Expand Down

0 comments on commit 7c55260

Please sign in to comment.