abhikmitra/ng-joyride

Move to next step programmatically

Opened this issue · 4 comments

This is a feature request rather than an issue.

Use case:

  1. Element type step points to a search input field.
  2. User enters search query and hits enter.
  3. Joyride goes to next step automatically.

Thank you for the awesome plug-in!

ng-joyride doesn't provide an instance of itself. For example, $modal in ui-bootstrap works like

var modalInstance = $modal.open({
      templateUrl: 'myModalContent.html',
      controller: 'ModalInstanceCtrl',
});

and you can interact with modalInstance later. ng-joyride just uses a very simple $watch on your config variable and uses that to kickstart the whole thing. To programmatically interact with the tour after its started would require a total rewrite to do correctly (or hacking in more random $watches for things).

I think your best bet for now is to just trigger the click event with a simple

$('.nextBtn').click()

I would love to see ng-joyride rewritten to use a provider for its creation instead of a directive, but it is a fair bit more work. The $modal src is a great reference if you're up to it https://github.com/angular-ui/bootstrap/blob/master/src/modal/modal.js

@beardedlinuxgeek Thanks for the suggestion. I was thinking whether, we should return the joyrideInstance using a callback for joyride-started-event, then allow people to modify it ?

Another possibly related feature request (which is why I posted here instead of starting a new thread):

I'd love to see the ability to start it at a particular step. For example, if you have a form of 100 fields, and the user is on, say, field 50 - then they click your sidebar "Guided Tour" button - it would be great if the ng-joyride could pick right up at the focused input element, rather than scrolling them back up to field 1 and making them click next 49 times. I suspect that's probably difficult or impossible, though, for the same reasons as above (needing a million $watch'es). But if not, that would be fantastic!

Thanks for the great tool!
Chris

+1 cmichaelis commented on 25 Oct 2014