nozzle / nzTour

Touring and on-boarding made simple for AngularJS -
http://nozzle.github.io/nzTour/
MIT License
73 stars 24 forks source link

How do check if a tour is active? #29

Open jornncc opened 8 years ago

jornncc commented 8 years ago

The api doesn't explain how I should check if a tour is currently active. Trying to advance the tour automatically when the user interacts with the ui (via nzTour.gotoStep()) but if the tour is currently not active, then we get this error:

screen shot 2016-05-20 at 9 07 01 am

tannerlinsley commented 8 years ago

I've seen that error in the past too. I'm actually looking at bringing nz-tour into the framework agnostic world right now, as I recently started using Jumpsuit (react/redux) instead of angular. I'm not sure how quick I can get this fixed, so if you or anyone out there wants to spearhead this, my appreciation would go far.

jornncc commented 8 years ago

Great. In-App-Tour is a POC for us at the moment, but if I get product management onboard with this project and decide to fold this into the app as a proper feature then I can help out with adding a few methods to the service api.

lebolo commented 8 years ago

The nzTour service has a current parameter that's used internally. It's set to false by default (and when the tour stops or finishes) and is set to an object while the tour is active (on start).

So maybe you could use the truthiness of current in the meantime? This plunker prints out current before and after start.

lebolo commented 8 years ago

Would be nice to have a more public API for this, maybe harden some of the code? Keeping this issue open as an enhancement request.

timelf123 commented 8 years ago

For posterity:

$scope.start = function() {
  console.log(nzTour.current, !!nzTour.current); // false
  nzTour.start(tour);
  console.log(nzTour.current, !!nzTour.current); // true
};