ahmed-wagdi/angular-joyride

Feature request

Closed this issue · 2 comments

Nice module. I selected this for a project because compared to the alternatives this works and is super simple and I was able to get running in just a minute (compared to ui-bootstrap tour which I still can't get working!).

One addition that would really be nice is the ability to navigate routes using ui-router.

Hey cramatt, i'm glad you found it useful :)

That's a good suggestion, i will look into whether or not it's possible with the current version. If not i'll work on adding it as a feature.

It should be possible now using the resumeJoyride function. This isn't an implementation specifically for ui-router so it requires a little bit of code from your end. I updated the documentation and here's a plunker example:

https://plnkr.co/edit/C5oh9JYZUgnb46Q1l9Y0?p=preview

I'm using ui-router version 1.0, if you're using something older then you will probably need to switch out the $transition events for the $stateChange events but the basic implementation is the same, you need to handle 2 cases:

  1. When the next step changes the state call resumeJoyride() after state changes
  2. When the next step attempts to change the state to the current state, this doesn't trigger the success/finish events in ui-router so it needs to be handled separately.

You could probably fully handle this in your controllers but i recommend doing it in app.run() to keep your code clean.