angular ui tour not working after route change
Closed this issue · 6 comments
I am using the exact versions of the following:
- Browser: [Chome|Firefox|IE|Safari]
- AngularJS: 1.6.4
- Angular Bootstrap: 2.2.0
- Angular UI Tour: 0.8
I have installed this library via: Bower
I have observed the following behavior:
Hello, i'm having a problem with route change and angular-ui-tour.
On route change, my tour is ended, but when I come back to the page where it should be created again, it just doesn't create anymore and I can't get it to work again, only if I refresh the browser..
when I go to another url and return to the tour page, it just doesn't starts anymore.
This is how I expected it to behave:
It should open the tour again when I return to the page.
Here is my tour config, and all related step configs:
uiTourService.createDetachedTour('detachedDemoTour');
var tour = uiTourService.getTourByName('detachedDemoTour');
tour.createStep({
element: angular.element(document.querySelector("#test")),
order: 10,
content: 'example content'
});
tour.start();
Additional notes/code:
I'm creating steps on the controller.
Hey @marcoaure, are there any errors in the console?
benmarch, no errors...
I realized that TourConfigProvider.enableNavigationInterceptors(); was making it terminate every time... when I turned it off, it never stops but is doing it wrong becouse I don't have that elements in another page.
The perfect would be when I change route, it hides and when it returns... it should show up again.
Is the issue that it doesn't start again when you trigger it to start? Or that it does not automatically start when again when you return to the first route?
you were right @benmarch i did it:
if(!uiTourService.getTourByName('detachedDemoTour')) {
uiTourService.createDetachedTour('detachedDemoTour');
}
now it works i will test doing the same for the tour.createStep, that i'm always creating it again.... i will post if it worked... thanks
Ah cool, I'm glad you got it working. I'll leave this issue open in case related problems come up. Feel free to comment back if you find more issues, or close if you think this is resolved.
It worked @benmarch, thank you so much...
If some one have the same problem, the solution is that workflow (in your project):
if(!uiTourService.getTourByName('detachedDemoTour')) {
uiTourService.createDetachedTour('detachedDemoTour');
}
var tour = uiTourService.getTourByName('detachedDemoTour');
if(!uiTourService.getTourByName('detachedDemoTour').hasStep(0)) {
tour.createStep({});
}
tour.start();